GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Flight] Use lazy reference for existing modules (#20445) · react/react@daf38ec

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-server/src
    • ReactFlightServer.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-server/src/ReactFlightServer.js‎

Copy file name to clipboardExpand all lines: packages/react-server/src/ReactFlightServer.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,14 @@ export function resolveModelToJSON(
435435
const writtenModules = request.writtenModules;
436436
const existingId = writtenModules.get(moduleKey);
437437
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+
}
438446
return serializeByValueID(existingId);
439447
}
440448
try {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.