Skip to content

Commit 06e8995

Browse files
authored
[Fizz] Ignore error if content node is gone before reveal (#33531)
1 parent 79d9aed commit 06e8995

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

fixtures/view-transition/src/components/App.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, {
44
useEffect,
55
useState,
66
unstable_addTransitionType as addTransitionType,
7-
use,
87
} from 'react';
98

109
import Chrome from './Chrome';

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineCodeStrings.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ export function revealCompletedBoundaries(batch) {
3434
for (let i = 0; i < batch.length; i += 2) {
3535
const suspenseIdNode = batch[i];
3636
const contentNode = batch[i + 1];
37-
// We can detach the content now.
38-
// Completions of boundaries within this contentNode will now find the boundary
39-
// in its designated place.
40-
contentNode.parentNode.removeChild(contentNode);
41-
37+
if (contentNode.parentNode === null) {
38+
// If the client has failed hydration we may have already deleted the streaming
39+
// segments. The server may also have emitted a complete instruction but cancelled
40+
// the segment. Regardless we can ignore this case.
41+
} else {
42+
// We can detach the content now.
43+
// Completions of boundaries within this contentNode will now find the boundary
44+
// in its designated place.
45+
contentNode.parentNode.removeChild(contentNode);
46+
}
4247
// Clear all the existing children. This is complicated because
4348
// there can be embedded Suspense boundaries in the fallback.
4449
// This is similar to clearSuspenseBoundary in ReactFiberConfigDOM.

0 commit comments

Comments
 (0)