Commit 3ef31d1
authored
Implement Partial Hydration for Activity (facebook#32863)
Stacked on facebook#32862 and facebook#32842.
This means that Activity boundaries now act as boundaries which can have
their effects mounted independently. Just like Suspense boundaries, we
hydrate the outer content first and then start hydrating the content in
an Offscreen lane. Flowing props or interacting with the content
increases the priority just like Suspense boundaries.
This skips emitting even the comments for `<Activity mode="hidden">` so
we don't hydrate those. Instead those are deferred to a later client
render.
The implementation are just forked copies of the SuspenseComponent
branches and then carefully going through each line and tweaking it.
The main interesting bit is that, unlike Suspense, Activity boundaries
don't have fallbacks so all those branches where you might commit a
suspended tree disappears. Instead, if something suspends while
hydration, we can just leave the dehydrated content in place. However,
if something does suspend during client rendering then it should bubble
up to the parent. Therefore, we have to be careful to only
pushSuspenseHandler when hydrating. That's really the main difference.
This just uses the existing basic Activity tests but I've started work
on port all of the applicable Suspense tests in SelectiveHydration-test
and PartialHydration-test to Activity versions.1 parent 17f88c8 commit 3ef31d1
File tree
18 files changed
+5381
-76
lines changed- packages
- react-dom/src/__tests__
- react-reconciler/src
- react-server/src
- scripts/error-codes
18 files changed
+5381
-76
lines changedLines changed: 1 addition & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3746 | 3746 | | |
3747 | 3747 | | |
3748 | 3748 | | |
3749 | | - | |
3750 | | - | |
3751 | 3749 | | |
3752 | | - | |
3753 | | - | |
3754 | 3750 | | |
3755 | 3751 | | |
3756 | 3752 | | |
| |||
3766 | 3762 | | |
3767 | 3763 | | |
3768 | 3764 | | |
| 3765 | + | |
3769 | 3766 | | |
3770 | 3767 | | |
3771 | 3768 | | |
| |||
3774 | 3771 | | |
3775 | 3772 | | |
3776 | 3773 | | |
3777 | | - | |
3778 | | - | |
3779 | 3774 | | |
3780 | | - | |
3781 | | - | |
3782 | 3775 | | |
3783 | 3776 | | |
3784 | 3777 | | |
| |||
3796 | 3789 | | |
3797 | 3790 | | |
3798 | 3791 | | |
3799 | | - | |
3800 | | - | |
3801 | 3792 | | |
3802 | | - | |
3803 | | - | |
3804 | 3793 | | |
3805 | 3794 | | |
3806 | 3795 | | |
| |||
0 commit comments