Preserve hook state when Suspense re-suspends - #5239
Merged
Conversation
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Resultscreate10kduration
usedJSHeapSize
filter-listduration
usedJSHeapSize
hydrate1kduration
usedJSHeapSize
many-updatesduration
usedJSHeapSize
replace1kduration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
text-updateduration
usedJSHeapSize
tododuration
usedJSHeapSize
update10th1kduration
usedJSHeapSize
|
|
Size Change: +45 B (+0.28%) Total Size: 15.9 kB 📦 View Changed
ℹ️ View Unchanged
|
JoviDeCroock
marked this pull request as ready for review
September 4, 2026 10:12
JoviDeCroock
added a commit
that referenced
this pull request
Sep 4, 2026
Alternative to the approach in #5239: instead of tracking whether the Suspense boundary has committed via lifecycle hooks and threading a preserveHooks flag through detachedClone, discard hooks per component in options._catchError when the suspending vnode never committed (oldVNode has no component). detachedClone then always keeps hook state, runs effect cleanups, and clears effect args so effects re-run on reveal. Also drops effects queued by the aborted render (_pendingEffects and _renderCallbacks), which otherwise made a changed-deps layout effect run twice on reveal. Size: compat +36 B br, hooks +6 B br (vs +70 B / +6 B for #5239).
JoviDeCroock
force-pushed
the
fix/suspense-preserve-mounted-hooks
branch
from
September 4, 2026 10:13
3ece2a9 to
bb593d1
Compare
Alternative to the approach in #5239: instead of tracking whether the Suspense boundary has committed via lifecycle hooks and threading a preserveHooks flag through detachedClone, discard hooks per component in options._catchError when the suspending vnode never committed (oldVNode has no component). detachedClone then always keeps hook state, runs effect cleanups, and clears effect args so effects re-run on reveal. Also drops effects queued by the aborted render (_pendingEffects and _renderCallbacks), which otherwise made a changed-deps layout effect run twice on reveal. Size: compat +36 B br, hooks +6 B br (vs +70 B / +6 B for #5239).
JoviDeCroock
force-pushed
the
fix/suspense-preserve-mounted-hooks
branch
from
September 4, 2026 10:29
bb593d1 to
aa0cf80
Compare
| "$_hydrationMismatch": "__m", | ||
| "$_list": "__", | ||
| "$_pendingEffects": "__h", | ||
| "$_passive": "__P", |
Member
There was a problem hiding this comment.
Q: Does this clash with _parentDom?
Member
Author
There was a problem hiding this comment.
_passive is set on hooks and _parentDom is set on the vnode/component so it should not clash
marvinhagemeister
approved these changes
Sep 4, 2026
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.
Preserves committed hook state when a Suspense boundary re-suspends while still resetting hooks for an initial suspended mount. Effects are cleaned up and re-run when content is revealed again, with client-rendering and hydration coverage.