Fix: fix simple SPA layout animations #3516
Open
+184
−55
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.
Avoid stale shared layout nodes during SPA navigations and add an HTML regression fixture for disconnected resumeFrom cases.
I encountered this problem on my SvelteKit app, but I suppose it affects other frameworks that approach navigation in a similar way as well. Svelte provides an onDestroy utility, but I wasn't able to get it to clean old nodes after the first navigation, only a full page refresh "fixed" it.
I suppose the additional checks shouldn't cause a perf regression since it happens only when adding or promoting, but I'm not very familiar with the codebase.
Please check carefully the logic and the test since I've narrowed down the issue thanks to Opus and GPT Codex, worked fine on my codebase, but haven't done anything extensive or stress tests.
Before the fix:
before_fix.mp4
After the fix:
after_fix.mp4