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 66d75d7
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,14 +1004,19 @@ 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 {
return waitForReference(
referencedChunk,
parentObject,
key,
response,
map,
path.slice(i),
);
}
}
}
const chunkValue = map(response, value);
Expand Down

0 comments on commit 66d75d7

Please sign in to comment.