Skip to content
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

SSR + Hydration #16

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

SSR + Hydration #16

wants to merge 7 commits into from

Conversation

CertainLach
Copy link

@CertainLach CertainLach commented Jan 15, 2025

I like this project, and I believe its implementation fits perfectly with SSR, as features like Suspense can be done better than frameworks like React do.

I already have an implementation with somewhat working hydration, but it is still too raw to use, this version of PR only has SSR, and I may split it to multiple PRs if you want.

SSR is implemented using partial html dom in Rust, and not optimized, I have some ideas on reducing the memory footprint, but they require a custom rendering macro, which will be able to statically optimize some of parts for both CSR and SSR cases.

Note that for hydration, we don't likely need any intermediate representation for elements, in my testing replacing Node with similar one with replaceWith/parentNode.replaceChild doesn't affect performance that much, and it is pretty cheap to rebuild full tree and reattach it with replacements, instead of finding all the nodes and then attaching event handlers to nodes that are already rendered by SSR

Overall, this branch is very unfinished, but I accept suggestions on the current implementation, as it pretty much matches what I'll do next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant