Home / File/ ReactDOMFizzInstructionSetShared.js — react Source File

ReactDOMFizzInstructionSetShared.js — react Source File

Architecture documentation for ReactDOMFizzInstructionSetShared.js, a javascript file in the react codebase. 0 imports, 7 dependents.

File javascript BabelCompiler Validation 7 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  2a61726f_9a35_9713_662f_bfb1ef81f49f["ReactDOMFizzInstructionSetShared.js"]
  b1a6866e_ce4b_5d18_7fa1_4aadab17110d["ReactDOMFizzInlineClientRenderBoundary.js"]
  b1a6866e_ce4b_5d18_7fa1_4aadab17110d --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  7a47e5d2_6c9e_762f_4349_198e05c0049d["ReactDOMFizzInlineCompleteBoundary.js"]
  7a47e5d2_6c9e_762f_4349_198e05c0049d --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  5b820faf_5c31_31cf_8dcf_b71d860ba420["ReactDOMFizzInlineCompleteBoundaryUpgradeToViewTransitions.js"]
  5b820faf_5c31_31cf_8dcf_b71d860ba420 --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  3086759d_edab_8869_d5d7_d5a91bc4ecd4["ReactDOMFizzInlineCompleteBoundaryWithStyles.js"]
  3086759d_edab_8869_d5d7_d5a91bc4ecd4 --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  07bad6be_fe08_241c_fae8_47bade18f59e["ReactDOMFizzInlineCompleteSegment.js"]
  07bad6be_fe08_241c_fae8_47bade18f59e --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  d9291f59_d616_7a42_96e8_02b6583c909c["ReactDOMFizzInlineFormReplaying.js"]
  d9291f59_d616_7a42_96e8_02b6583c909c --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  99926b08_d2fc_8b60_1b6a_df3cb95ba3d2["ReactDOMFizzInstructionSetExternalRuntime.js"]
  99926b08_d2fc_8b60_1b6a_df3cb95ba3d2 --> 2a61726f_9a35_9713_662f_bfb1ef81f49f
  style 2a61726f_9a35_9713_662f_bfb1ef81f49f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/* eslint-disable dot-notation */

// Shared implementation and constants between the inline script and external
// runtime instruction sets.

const ELEMENT_NODE = 1;
const COMMENT_NODE = 8;
const ACTIVITY_START_DATA = '&';
const ACTIVITY_END_DATA = '/&';
const SUSPENSE_START_DATA = '$';
const SUSPENSE_END_DATA = '/$';
const SUSPENSE_PENDING_START_DATA = '$?';
const SUSPENSE_QUEUED_START_DATA = '$~';
const SUSPENSE_FALLBACK_START_DATA = '$!';

const FALLBACK_THROTTLE_MS = 300;

const SUSPENSEY_FONT_AND_IMAGE_TIMEOUT = 500;

// If you have a target goal in mind for a metric to hit, you don't want the
// only reason you miss it by a little bit to be throttling heuristics.
// This tries to avoid throttling if avoiding it would let you hit this metric.
// This is derived from trying to hit an LCP of 2.5 seconds with some head room.
const TARGET_VANITY_METRIC = 2300;

// TODO: Symbols that are referenced outside this module use dynamic accessor
// notation instead of dot notation to prevent Closure's advanced compilation
// mode from renaming. We could use extern files instead, but I couldn't get it
// working. Closure converts it to a dot access anyway, though, so it's not an
// urgent issue.

export function revealCompletedBoundaries(batch) {
  window['$RT'] = performance.now();
  for (let i = 0; i < batch.length; i += 2) {
    const suspenseIdNode = batch[i];
    const contentNode = batch[i + 1];
    if (contentNode.parentNode === null) {
      // If the client has failed hydration we may have already deleted the streaming
      // segments. The server may also have emitted a complete instruction but cancelled
      // the segment. Regardless we can ignore this case.
    } else {
      // We can detach the content now.
      // Completions of boundaries within this contentNode will now find the boundary
      // in its designated place.
      contentNode.parentNode.removeChild(contentNode);
    }
    // Clear all the existing children. This is complicated because
    // there can be embedded Suspense boundaries in the fallback.
    // This is similar to clearSuspenseBoundary in ReactFiberConfigDOM.
    // TODO: We could avoid this if we never emitted suspense boundaries in fallback trees.
    // They never hydrate anyway. However, currently we support incrementally loading the fallback.
    const parentInstance = suspenseIdNode.parentNode;
    if (!parentInstance) {
      // We may have client-rendered this boundary already. Skip it.
      continue;
    }

    // Find the boundary around the fallback. This is always the previous node.
    const suspenseNode = suspenseIdNode.previousSibling;

// ... (594 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactDOMFizzInstructionSetShared.js do?
ReactDOMFizzInstructionSetShared.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactDOMFizzInstructionSetShared.js?
ReactDOMFizzInstructionSetShared.js defines 7 function(s): clientRenderBoundary, completeBoundary, completeBoundaryWithStyles, completeSegment, listenToFormSubmissionsForReplaying, revealCompletedBoundaries, revealCompletedBoundariesWithViewTransitions.
What files import ReactDOMFizzInstructionSetShared.js?
ReactDOMFizzInstructionSetShared.js is imported by 7 file(s): ReactDOMFizzInlineClientRenderBoundary.js, ReactDOMFizzInlineCompleteBoundary.js, ReactDOMFizzInlineCompleteBoundaryUpgradeToViewTransitions.js, ReactDOMFizzInlineCompleteBoundaryWithStyles.js, ReactDOMFizzInlineCompleteSegment.js, ReactDOMFizzInlineFormReplaying.js, ReactDOMFizzInstructionSetExternalRuntime.js.
Where is ReactDOMFizzInstructionSetShared.js in the architecture?
ReactDOMFizzInstructionSetShared.js is located at packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/server/fizz-instruction-set).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free