Skip to content

Commit 9d9e478

Browse files
committed
Don't block on debug channel if it's not wired up
1 parent eb7f8b4 commit 9d9e478

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

fixtures/flight/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async function hydrateApp() {
9292
}),
9393
{
9494
callServer,
95-
debugChannel,
95+
// debugChannel,
9696
findSourceMapURL,
9797
}
9898
);

packages/react-client/src/ReactFlightClient.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,26 @@ function waitForReference<T>(
13531353
map: (response: Response, model: any, parentObject: Object, key: string) => T,
13541354
path: Array<string>,
13551355
): T {
1356+
if (
1357+
__DEV__ &&
1358+
// TODO: This should check for the existence of the "readable" side, not the "writable".
1359+
response._debugChannel === undefined
1360+
) {
1361+
if (
1362+
referencedChunk.status === PENDING &&
1363+
parentObject[0] === REACT_ELEMENT_TYPE &&
1364+
(key === '4' || key === '5')
1365+
) {
1366+
// If the parent object is an unparsed React element tuple, and this is a reference
1367+
// to the owner or debug stack. Then we expect the chunk to have been emitted earlier
1368+
// in the stream. It might be blocked on other things but chunk should no longer be pending.
1369+
// If it's still pending that suggests that it was referencing an object in the debug
1370+
// channel, but no debug channel was wired up so it's missing. In this case we can just
1371+
// drop the debug info instead of halting the whole stream.
1372+
return (null: any);
1373+
}
1374+
}
1375+
13561376
let handler: InitializationHandler;
13571377
if (initializingHandler) {
13581378
handler = initializingHandler;

0 commit comments

Comments
 (0)