Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 84f29eb

Browse files
authoredNov 14, 2024
Update React 19 Upgrade Guide with pre-warming change (#7292)
* Update React 19 Upgrade Guide with pre-warming change * Better captions
1 parent 1d1767f commit 84f29eb

File tree

6 files changed

+20
-2
lines changed

6 files changed

+20
-2
lines changed
 
67.2 KB
Loading
68.4 KB
Loading
67.1 KB
Loading
67.7 KB
Loading

‎src/components/MDX/Diagram.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ interface DiagramProps {
1515

1616
function Caption({text}: {text: string}) {
1717
return (
18-
<div className="w-full table">
19-
<figcaption className="p-1 sm:p-2 mt-0 sm:mt-0 text-gray-40 text-base lg:text-lg text-center leading-tight table-caption">
18+
<div className="w-full flex justify-center">
19+
<figcaption className="p-1 sm:p-2 mt-0 sm:mt-0 text-gray-40 text-base lg:text-lg text-center leading-tight table-caption max-w-lg">
2020
{text}
2121
</figcaption>
2222
</div>

‎src/content/blog/2024/04/25/react-19-upgrade-guide.md

+18
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,24 @@ When double rendering in Strict Mode in development, `useMemo` and `useCallback`
536536

537537
As with all Strict Mode behaviors, these features are designed to proactively surface bugs in your components during development so you can fix them before they are shipped to production. For example, during development, Strict Mode will double-invoke ref callback functions on initial mount, to simulate what happens when a mounted component is replaced by a Suspense fallback.
538538

539+
### Improvements to Suspense {/*improvements-to-suspense*/}
540+
541+
In React 19, when a component suspends, React will immediately commit the fallback of the nearest Suspense boundary without waiting for the entire sibling tree to render. After the fallback commits, React schedules another render for the suspended siblings to "pre-warm" lazy requests in the rest of the tree:
542+
543+
<Diagram name="prerender" height={162} width={1270} alt="Diagram showing a tree of three components, one parent labeled Accordion and two children labeled Panel. Both Panel components contain isActive with value false.">
544+
545+
Previously, when a component suspended, the suspended siblings were rendered and then the fallback was committed.
546+
547+
</Diagram>
548+
549+
<Diagram name="prewarm" height={162} width={1270} alt="The same diagram as the previous, with the isActive of the first child Panel component highlighted indicating a click with the isActive value set to true. The second Panel component still contains value false." >
550+
551+
In React 19, when a component suspends, the fallback is committed and then the suspended siblings are rendered.
552+
553+
</Diagram>
554+
555+
This change means Suspense fallbacks display faster, while still warming lazy requests in the suspended tree.
556+
539557
### UMD builds removed {/*umd-builds-removed*/}
540558

541559
UMD was widely used in the past as a convenient way to load React without a build step. Now, there are modern alternatives for loading modules as scripts in HTML documents. Starting with React 19, React will no longer produce UMD builds to reduce the complexity of its testing and release process.

0 commit comments

Comments
 (0)
Please sign in to comment.