Repository navigation
fix(motion): preserve keyed elements returning during exit #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tannerlinsley
wants to merge
2
commits into
main
Choose a base branch
from
taren/keyed-exit-reentry
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@tanstack/charts': patch | ||
| --- | ||
|
|
||
| Preserve keyed SVG elements and live point positions when an interrupted exit returns in the next update. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: TanStack/charts
Length of output: 13111
🏁 Script executed:
Repository: TanStack/charts
Length of output: 15210
🏁 Script executed:
Repository: TanStack/charts
Length of output: 13654
🏁 Script executed:
Repository: TanStack/charts
Length of output: 36751
🏁 Script executed:
Repository: TanStack/charts
Length of output: 9161
🏁 Script executed:
Repository: TanStack/charts
Length of output: 3359
🏁 Script executed:
Repository: TanStack/charts
Length of output: 804
Make exit retention parent-aware.
When a keyed child returns under a different surviving group, this scene-wide key check retains the old child. Parent-local reconciliation then creates the returning child in the new group, so both nodes can paint during the new animation. The old node is removed when that animation settles, so the issue is transient rather than permanent. Retain the old node only when the returning key belongs to the same parent group.
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, thanks. A regression test against this head gets two nodes immediately after the key returns under a different surviving parent. The local correction records the parent key in the existing scene-node context and retains an exit only for that same parent. All 78 motion tests pass. Chromium, Firefox and WebKit also pass leaf/group reparenting plus same-parent continuity controls, 12 cases total; the current head fails the six reparenting cases. The correction adds 0.024 decimal kB gzip to Motion SVG, with the other 145 measured consumers unchanged. That exceeds the exact ceiling approved for this PR, so the correction remains local pending the narrow cost decision and full validation. I will not merge the current head with this finding unresolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannerlinsley Thanks for the detailed validation. The reported reparenting failures and same-parent controls support the parent-aware correction.
The additional 0.024 decimal kB gzip needs a separate budget decision; the existing approval does not cover it. This finding should remain open until the correction reaches the PR head and validation is complete.
Thanks for clarifying the parent-local reconciliation behavior.
✏️ Learnings added
You are interacting with an AI system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extended regression also caught a second part of this: removing the duplicate DOM node alone left the presentation point at x=40 while the returned node painted at x=160. The complete local correction now clears presentation state when its old node has left the renderer root, including nested groups.
All 78 motion tests pass, and the actual packed package passes the direct and nested re-entry checks in Chromium, Firefox and WebKit. The full repository run reports only the bundle ceiling and benchmark fingerprint gates failing. The final Motion SVG gzip measurement is 23.322 decimal kB, replacing the earlier 23.301 estimate; the other 145 bundle consumers are unchanged.
This remains local while the exact ceiling decision is pending. The current PR head is unchanged and should not be merged yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannerlinsley Thanks for clarifying the presentation-state requirement. Parent-aware DOM cleanup alone is not sufficient: presentation state must also clear when the old node leaves the renderer root, including through nested-group removal.
Your reported motion tests and packed-package browser checks support the complete local correction. The final reported measurement is 23.322 decimal kB gzip, not 23.301.
The finding should remain open while the correction is local. The exact ceiling decision and benchmark fingerprint gate remain pending. The unchanged PR head is not ready to merge.
✏️ Learnings added
🧠 Learnings used
You are interacting with an AI system.