Skip to content

Commit 4e45f45

Browse files
committed
Update stale blocked values in createModelResolver
1 parent 4a846da commit 4e45f45

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/react-client/src/ReactFlightClient.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,25 @@ function createModelResolver<T>(
584584
}
585585
return value => {
586586
parentObject[key] = value;
587+
588+
// If this is a tuple that's representing a react element, and the props
589+
// were resolved (4th item, key '3'), the props of `blocked.value` must be
590+
// updated.
591+
if (
592+
Array.isArray(parentObject) &&
593+
key === '3' &&
594+
blocked.value &&
595+
blocked.value.$$typeof === REACT_ELEMENT_TYPE
596+
) {
597+
blocked.value.props = value;
598+
}
599+
600+
// If this is the root object for a model reference, where `blocked.value`
601+
// is a stale `null`, the resolved value can be used directly.
602+
if (key === '' && blocked.value === null) {
603+
blocked.value = value;
604+
}
605+
587606
blocked.deps--;
588607
if (blocked.deps === 0) {
589608
if (chunk.status !== BLOCKED) {

0 commit comments

Comments
 (0)