-
The Remix team has been pumped about streaming data from the server, and no-JS-first principle has been an principle of teaching Remix, which I loved ❤️ But the following does not work without without JS. The content never appears. (Framework mode) <Suspense fallback="Loading..."> <Await resolve={loaderData.myPromise}> Hello World! </Await> </Suspense> This took me by surprise! Is this expected? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The way SSR streaming in React works is that it send an inline script with the code needed by React to update the UI on the correct place. To be able to work without JS, React would have to stop using out of order streaming and instead block the while UI from rendering server-side until that suspense boundary is resolved, then stream the HTML and keep working on the rest. Additionally to that, React Router also uses inline JS to send the resolved promises data to append it to the data the framework has, so also the data needs JS. But the first one to need JS is React, even if React Router changed the way it works you will need JS. |
Beta Was this translation helpful? Give feedback.
The way SSR streaming in React works is that it send an inline script with the code needed by React to update the UI on the correct place.
To be able to work without JS, React would have to stop using out of order streaming and instead block the while UI from rendering server-side until that suspense boundary is resolved, then stream the HTML and keep working on the rest.
Additionally to that, React Router also uses inline JS to send the resolved promises data to append it to the data the framework has, so also the data needs JS. But the first one to need JS is React, even if React Router changed the way it works you will need JS.