-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NoSsr] Investigate better alternatives in React 18 #659
Comments
To extend on the different product use cases we have had so far for the NoSsr component, I have seen:
Suspense seems to cover 3. |
Suspsense covers 1, 3, 4. 2 does not need an extra component. 5 is an issue with the SSR setup.
Not sure what the type of attack has to do with it. If you're DDoSed no amount of |
So, the path we might be able to take is to deprecate NoSsr? |
We'll want to wait for a stable release of 18 anyway. And then we can go through each use case of
Yeah, this should happen at another layer. It's not even clear this works since you would have to signal to the client side bundle that the rendered tree changes. Otherwise you're hydrating differnt trees which generally has undefined behavior. If it does work then you're degrading client side rendering as well. You should just send the HTML skeleton and then call |
I'm currently need suspense at my top-level component. In my case, it's <Suspense fallback={<div>Loadingss...</div>}>
<DefaultLayout>
<Component {...pageProps} />
</DefaultLayout>
</Suspense> but in order for this to work, I need to wrap it with <NoSsr fallback="Loading">
<Suspense fallback="Loading">
<...Rest/>
</Suspense>
</NoSsr> Is this the correct approach for now, in order to make the suspense of React 18 work? I'm afraid this might slow down the |
In React 18 you can use |
Summary 💡
Check each use case with React 18 in mind. Our docs are probably a good start.
Examples 🌈
can be written without
NoSsr
alltogether.Motivation 🔦
NoSsr
only renders its children when an effect ran. This leads to cascading updates which is especially problematic for the default case wheredefer={false}
and we use layout effects.The reason we have
NoSsr
is to not render components that don't do anything before hydration. In React 18 we now have access to Suspense which enables streaming rendering and selective hydration which should cover most use cases while also improving existing scenarios (e.g. prioritizing hydration).Search keywords:
The text was updated successfully, but these errors were encountered: