Skip to content

Commit

Permalink
Don't call waitForReference for initialized chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Jul 24, 2024
1 parent d994fd2 commit 3f62042
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,14 +1004,22 @@ function getOutlinedModel<T>(
for (let i = 1; i < path.length; i++) {
value = value[path[i]];
if (value.$$typeof === REACT_LAZY_TYPE) {
return waitForReference(
value._payload,
parentObject,
key,
response,
map,
path.slice(i),
);
const referencedChunk: SomeChunk<any> = value._payload;
if (referencedChunk.status === INITIALIZED) {
value = referencedChunk.value;
} else if (
referencedChunk.status === BLOCKED ||
referencedChunk.status === PENDING
) {
return waitForReference(
referencedChunk,
parentObject,
key,
response,
map,
path.slice(i),
);
}
}
}
const chunkValue = map(response, value);
Expand Down

0 comments on commit 3f62042

Please sign in to comment.