-
Notifications
You must be signed in to change notification settings - Fork 186
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
feat: ssr improvements #2237
base: ssr
Are you sure you want to change the base?
feat: ssr improvements #2237
Conversation
Good stuff! We're busy getting Electric Cloud ready for the first folks next week so won't time for a bit to give this serious attention but a few thoughts:
|
Here are some of my thoughts:
|
Ah yes — handle/offset aren't part of the shape definition — they're just parameters for traversing the shape log — so yes, we shouldn't use them when generating the shape key.
Sure yeah this could happen. Generally though I assume they'll preload in the server component and then the client component will have a useShape and grab the data during SSR from the server cache. |
Yes, but I assume we will still allow access to the data on the server only? |
Yeah for sure. It seems how it should work is that only data you pass into the HydrationBoundary would get sent through. |
I dedicated some time to experimenting with the code above and made several important enhancements:
Refactoring ElectricScripts:
ElectricScripts
insideElectricProvider
. This change allowsElectricProvider
to manage the following:<script>
tag containing__ELECTRIC_SSR_STATE__
is added to the document.__ELECTRIC_SSR_STATE__
is correctly parsed on the client, allowing it to be set in the state and facilitating successful hydration.Support for RSC:
useShape
useShape
hook allowing to accept an already initialized shape as a parameter.Related to #2232 and #2219
Examples
Next.js
Todo
serializeShape
. Instead, we could implement atoString
method within theShape
class that internally callsserializeShape
. This approach would streamline the process and enhance code readability.client.ts
. Currently, I am passing theisLive
parameter to indicate that the stream should switch to live mode immediately. I'm pretty sure there is better approach on this.