We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3f9205c commit daf38ecCopy full SHA for daf38ec
packages/react-server/src/ReactFlightServer.js
@@ -435,6 +435,14 @@ export function resolveModelToJSON(
435
const writtenModules = request.writtenModules;
436
const existingId = writtenModules.get(moduleKey);
437
if (existingId !== undefined) {
438
+ if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
439
+ // If we're encoding the "type" of an element, we can refer
440
+ // to that by a lazy reference instead of directly since React
441
+ // knows how to deal with lazy values. This lets us suspend
442
+ // on this component rather than its parent until the code has
443
+ // loaded.
444
+ return serializeByRefID(existingId);
445
+ }
446
return serializeByValueID(existingId);
447
}
448
try {
0 commit comments