Skip to content

Commit

Permalink
Unwrap lazy before reading the value
Browse files Browse the repository at this point in the history
This is important if the lazy is at the root of the chunk.
  • Loading branch information
sebmarkbage committed Sep 10, 2024
1 parent d724ba9 commit ef231d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,7 @@ function getOutlinedModel<T>(
case INITIALIZED:
let value = chunk.value;
for (let i = 1; i < path.length; i++) {
value = value[path[i]];
if (value.$$typeof === REACT_LAZY_TYPE) {
while (value.$$typeof === REACT_LAZY_TYPE) {
const referencedChunk: SomeChunk<any> = value._payload;
if (referencedChunk.status === INITIALIZED) {
value = referencedChunk.value;
Expand All @@ -1069,10 +1068,11 @@ function getOutlinedModel<T>(
key,
response,
map,
path.slice(i),
path.slice(i - 1),
);
}
}
value = value[path[i]];
}
const chunkValue = map(response, value);
if (__DEV__ && chunk._debugInfo) {
Expand Down

0 comments on commit ef231d1

Please sign in to comment.