Skip to content

Commit

Permalink
Update stale blocked values in createModelResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Mar 29, 2024
1 parent 4a846da commit 4e45f45
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,25 @@ function createModelResolver<T>(
}
return value => {
parentObject[key] = value;

// If this is a tuple that's representing a react element, and the props
// were resolved (4th item, key '3'), the props of `blocked.value` must be
// updated.
if (
Array.isArray(parentObject) &&
key === '3' &&
blocked.value &&
blocked.value.$$typeof === REACT_ELEMENT_TYPE
) {
blocked.value.props = value;
}

// If this is the root object for a model reference, where `blocked.value`
// is a stale `null`, the resolved value can be used directly.
if (key === '' && blocked.value === null) {
blocked.value = value;
}

blocked.deps--;
if (blocked.deps === 0) {
if (chunk.status !== BLOCKED) {
Expand Down

0 comments on commit 4e45f45

Please sign in to comment.