Replies: 3 comments 2 replies
-
same rule for the js assets. |
Beta Was this translation helpful? Give feedback.
-
I just came here to propose this too 👍 As you suggest, it looks although Given Remix can synchronously determine which static resources are required for any given route, it could offer significant performance gain if they're flushed to the client before loaders have completed. I think this could be done v. nicely via 103 early hints, however last time I checked they have almost no support across popular servers. If that's not an option then, given the HTML is already being streamed for non-bots in the default template (i.e. an accurate http status code is forgone), the head could be flushed early with a 200. It could be tricky in Remix as the head is rendered as part of a single React render. I expect the root could be rendered separately although prob not ideal for managing head tags once in the client, or maybe React Suspense + SSR streaming could help here, e.g. // Render this before `Loaders` have finished?
const Root = () => (
<html>
<head>
<Links />
<Scripts preload />
</head>
<Suspense fallback={null}>
<AwaitLoaders>
<body>
<Outlet />
</body>
</AwaitLoaders>
<Suspense>
</html>
); The downside of using React SSR Streaming is I think it requires JS which is a shame. EDIT: I just realised loaders can redirect / set cookies etc. so flushing the head early prob isn't viable because that behaviour would have to be replicated in JS which is a PITA. (i.e. |
Beta Was this translation helpful? Give feedback.
-
You will be able to do this yourself when we ship |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
stylesheet will blocking the page rendering. we should make it loading as quick as possible.
we could get all the links which export from route module, I guess we can and should flush it before the loader resolve.
Beta Was this translation helpful? Give feedback.
All reactions