47
}
48
}
49
50
-export function completeBoundary(suspenseBoundaryID, contentID, errorDigest) {
50
+export function completeBoundary(suspenseBoundaryID, contentID) {
51
const contentNode = document.getElementById(contentID);
52
if (!contentNode) {
53
// If the client has failed hydration we may have already deleted the streaming
70
// Find the boundary around the fallback. This is always the previous node.
71
const suspenseNode = suspenseIdNode.previousSibling;
72
73
- if (!errorDigest) {
74
- // Clear all the existing children. This is complicated because
75
- // there can be embedded Suspense boundaries in the fallback.
76
- // This is similar to clearSuspenseBoundary in ReactFiberConfigDOM.
77
- // TODO: We could avoid this if we never emitted suspense boundaries in fallback trees.
78
- // They never hydrate anyway. However, currently we support incrementally loading the fallback.
79
- const parentInstance = suspenseNode.parentNode;
80
- let node = suspenseNode.nextSibling;
81
- let depth = 0;
82
- do {
83
- if (node && node.nodeType === COMMENT_NODE) {
84
- const data = node.data;
85
- if (data === SUSPENSE_END_DATA || data === ACTIVITY_END_DATA) {
86
- if (depth === 0) {
87
- break;
88
- } else {
89
- depth--;
90
- }
91
- } else if (
92
- data === SUSPENSE_START_DATA ||
93
- data === SUSPENSE_PENDING_START_DATA ||
94
- data === SUSPENSE_FALLBACK_START_DATA ||
95
- data === ACTIVITY_START_DATA
96
- ) {
97
- depth++;
73
+ // Clear all the existing children. This is complicated because
74
+ // there can be embedded Suspense boundaries in the fallback.
75
+ // This is similar to clearSuspenseBoundary in ReactFiberConfigDOM.
76
+ // TODO: We could avoid this if we never emitted suspense boundaries in fallback trees.
77
+ // They never hydrate anyway. However, currently we support incrementally loading the fallback.
78
+ const parentInstance = suspenseNode.parentNode;
79
+ let node = suspenseNode.nextSibling;
80
+ let depth = 0;
81
+ do {
82
+ if (node && node.nodeType === COMMENT_NODE) {
83
+ const data = node.data;
84
+ if (data === SUSPENSE_END_DATA || data === ACTIVITY_END_DATA) {
85
+ if (depth === 0) {
86
+ break;
87
+ } else {
88
+ depth--;
89
}
90
+ } else if (
91
+ data === SUSPENSE_START_DATA ||
92
+ data === SUSPENSE_PENDING_START_DATA ||
93
+ data === SUSPENSE_FALLBACK_START_DATA ||
94
+ data === ACTIVITY_START_DATA
95
+ ) {
96
+ depth++;
97
}
98
+ }
99
101
- const nextNode = node.nextSibling;
102
- parentInstance.removeChild(node);
103
- node = nextNode;
104
- } while (node);
105
-
106
- const endOfBoundary = node;
100
+ const nextNode = node.nextSibling;
101
+ parentInstance.removeChild(node);
102
+ node = nextNode;
103
+ } while (node);
104
108
- // Insert all the children from the contentNode between the start and end of suspense boundary.
109
- while (contentNode.firstChild) {
110
- parentInstance.insertBefore(contentNode.firstChild, endOfBoundary);
111
- }
105
+ const endOfBoundary = node;
106
113
- suspenseNode.data = SUSPENSE_START_DATA;
114
- } else {
115
- suspenseNode.data = SUSPENSE_FALLBACK_START_DATA;
116
- suspenseIdNode.setAttribute('data-dgst', errorDigest);
107
+ // Insert all the children from the contentNode between the start and end of suspense boundary.
108
+ while (contentNode.firstChild) {
109
+ parentInstance.insertBefore(contentNode.firstChild, endOfBoundary);
110
}
111
112
+ suspenseNode.data = SUSPENSE_START_DATA;
113
+
114
if (suspenseNode['_reactRetry']) {
115
suspenseNode['_reactRetry']();
116
}
229
}
230
231
Promise.all(dependencies).then(
237
- window['$RC'].bind(null, suspenseBoundaryID, contentID, ''),
238
- window['$RC'].bind(
239
- null,
240
- suspenseBoundaryID,
241
- contentID,
242
- 'Resource failed to load',
243
- ),
232
+ window['$RC'].bind(null, suspenseBoundaryID, contentID),
233
+ window['$RX'].bind(null, suspenseBoundaryID, 'CSS failed to load'),
234
);
235
}
236