fix(replay): fix playback stopping when skipping backwards with virtual DOM#1806
Open
d0ugal wants to merge 3 commits intorrweb-io:masterfrom
Open
fix(replay): fix playback stopping when skipping backwards with virtual DOM#1806d0ugal wants to merge 3 commits intorrweb-io:masterfrom
d0ugal wants to merge 3 commits intorrweb-io:masterfrom
Conversation
🦋 Changeset detectedLatest commit: d42e107 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
eb1db3b to
4062ab9
Compare
…al DOM When using the virtual DOM (useVirtualDom: true), skipping backwards could cause playback to stop entirely. destroyTree() was called before legacy missing nodes were resolved, resetting the virtual DOM mirror. Subsequent createOrGetNode() and diff() calls used the empty mirror, producing nodes with -1 IDs that were never added to the real DOM mirror. Move destroyTree() after the legacy missing nodes loop so the virtual DOM mirror is still available when converting legacy nodes.
f5c689e to
5a99ce0
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
When
useVirtualDomis enabled (the default), skipping backwards in a replay could cause playback to stop entirely.destroyTree()was called before legacy missing nodes were resolved, resetting the virtual DOM mirror. SubsequentcreateOrGetNode()anddiff()calls used the empty mirror, producing nodes with-1IDs that were never added to the real DOM mirror.The fix moves
destroyTree()after the legacy missing nodes loop so the virtual DOM mirror is still available when converting legacy nodes.This may also fix #1358.
Future improvement
The style mutation application (
constructedStyleMutationsandadoptedStyleSheets) in the Flush handler is not wrapped in try/catch. An exception there would propagate up and preventtimer.start()from executing, also stopping playback. Adding try/catch (matching the pattern used elsewhere in the handler) would improve resilience.Disclosure
Claude was used to help with this change but it was manually verified.
Test plan