-
Notifications
You must be signed in to change notification settings - Fork 48.8k
[Fizz] Ignore error if content node is gone before reveal #33531
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
base: main
Are you sure you want to change the base?
Conversation
Comparing: 6b7e207...a838aeb Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
// in its designated place. | ||
contentNode.parentNode.removeChild(contentNode); | ||
|
||
if (contentNode.isConnected) { |
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.
Just check parentNode instead. It's fine if its parent is deleted, which it won't be because it's the body. Cheaper, more compatible, compressed with other references to parentNode.
There is a feature where we might want to stream into a disconnected node where the top level of the stream wouldn't be the body but we can continue it even after it's removed.
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.
Don’t overcomplicate it—just check parentNode, that’s all you need. No one’s ever going to delete the body, so it’s safe. Lean, efficient, and best practice approved. Plus, if you ever want to hack a stream into a detached node, this won’t break. Supreme review seals the deal—every global dev has to nod!
e62bd38
to
a838aeb
Compare
@@ -4,7 +4,6 @@ import React, { | |||
useEffect, | |||
useState, | |||
unstable_addTransitionType as addTransitionType, | |||
use, |
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.
leftover from #33511
Summary
Same as #33068 but for the case where the content node is still there when completed but gone by the time we want to reveal (see #33511).
How did you test this change?
b7e2de63-20250611
toa00ca6f6-20250611
vercel/next.js#80421NestedReveal
and removes content nodes