Skip to content

Commit

Permalink
[Fiber] render boundary in fallback if it contains a new stylesheet d…
Browse files Browse the repository at this point in the history
…uring sync update (#28965)

Updates Suspensey instances and resources to preload even during urgent
updates and to potentially suspend.

The current implementation is unchanged for transitions but for sync
updates if there is a suspense boundary above the resource/instance it
will be rendered in fallback mode instead.

Note: This behavior is not what we want for images once we make them
suspense enabled. We will need to have forked behavior here to
distinguish between stylesheets which should never commit when not
loaded and images which should commit after a small delay
  • Loading branch information
gnoff committed May 21, 2024
1 parent 0f58454 commit 217b2cc
Show file tree
Hide file tree
Showing 8 changed files with 495 additions and 104 deletions.
6 changes: 3 additions & 3 deletions packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -3154,7 +3154,6 @@ export function mayResourceSuspendCommit(resource: Resource): boolean {
}

export function preloadInstance(type: Type, props: Props): boolean {
// Return true to indicate it's already loaded
return true;
}

Expand All @@ -3163,10 +3162,11 @@ export function preloadResource(resource: Resource): boolean {
resource.type === 'stylesheet' &&
(resource.state.loading & Settled) === NotLoaded
) {
// we have not finished loading the underlying stylesheet yet.
// Return false to indicate this resource should suspend
return false;
}
// Return true to indicate it's already loaded

// Return true to indicate this resource should not suspend
return true;
}

Expand Down
Loading

0 comments on commit 217b2cc

Please sign in to comment.