[Feature] Reconciler: keep host-added attributes on retained nodes
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Start with the failing repro in packages/charts-core/test-repro/11-renderer-dom.test.ts and the syncAttributes removal loop in src/reconcile.ts (around lines 165-167); the animated path is in src/motion.ts (around lines 2204-2214), and focus layers re-render near line 1209. Done means the repro passes on both paths, with the design choice (reserved prefix versus a preserveAttributes option) settled by maintainers first. Part B, the missing className option on cartesian marks, is a separate docs-and-options change.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: @tanstack/charts 1.1.0 (57774e1).
An app cannot keep its own per-node state (a data-* marker, a CSS custom property) on renderer nodes, because the reconciler strips it on the next rebuild.
A. Reconciler removes host-added attributes
syncAttributesruns for every retained element and removes each attribute the next scene element does not emit, includingstyle,data-*andclass: reconcile.ts:165-167.- The animated path does the same, exempting only
data-ts-motion-role,transformandopacity: motion.ts:2204-2214. - Focus layers are re-rendered through the same reconciler on each focus change, so a host write there is lost: motion.ts:1209-1211.
- The docs mention
data-ts-keymatching but not host attributes: rendering-and-export.md:130.
Repro: save as packages/charts-core/src/repro.test.ts, run pnpm vitest run packages/charts-core/src/repro.test.ts (vitest + jsdom).
import { expect, it } from 'vitest'
import { reconcileChartSvg } from './reconcile'
const svg = (extra = '') =>
`<svg xmlns="http://www.w3.org/2000/svg"><circle data-ts-key="a" class="ts-chart__dot" cx="1" cy="1" r="2"${extra}/></svg>`
it('keeps host-added attributes on a retained node across a rebuild', () => {
const container = document.createElement('div')
reconcileChartSvg(container, svg())
const node = container.querySelector('circle')!
node.setAttribute('data-x-active', '1')
node.style.setProperty('--x-glow', '1')
reconcileChartSvg(container, svg(' cx="5"')) // same key, cx changes
expect(container.querySelector('circle')).toBe(node) // node is retained
expect(node.getAttribute('data-x-active')).toBe('1')
expect(node.style.getPropertyValue('--x-glow')).toBe('1')
})
Actual: AssertionError: expected null to be '1' at the data-x-active assertion. The test covers the non-animated reconciler only.
Expected: attributes the scene never emits (a documented prefix such as data-x-*, or custom properties inside style) are left alone on retained nodes. Preferred: skip removal for a reserved prefix in both syncAttributes loops. Alternative: a reconcile.preserveAttributes: string[] host option.
B. Cartesian marks: no documented class hook
Moved to #212 (documenting the renderer's public contracts), together with C and D from this comment (
data-ts-motion-roleand the group container classes). A class hook does not replace A for per-node dynamic state.
- Ngôn ngữ chính
- TypeScript
- Star
- 842
- Fork
- 53
- Merge trung bình
- 4 giờ 40 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của TanStack/charts
-
[Bug] Focus guides: `url(#id)` paints ignore `idPrefix`Có thể đã có người làm @getdownandcode đã nhận 6 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
TanStack/charts#211 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Printed charts keep their screen width: resize redraw waits for an animation frameCó thể đã có người làm @piecyk đã nhận 6 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Feature] Readable outside labels for crowded pie and donut chartsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
TanStack/charts#227 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
TanStack/charts#216 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 57/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của TanStack/charts
Issue tương tự
-
DQ assisgnment closing at CRĐang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
equinor/prisma-decision-web#919 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[DC] OneLogin sync imports a partial user list when an API request failsCó thể đã có người làm @RaphaelFakhri đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
bitwarden/directory-connector#1276 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
home-assistant/installer#324 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mondriaan
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
knaw-huc/textannoviz#733 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày