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

Skip the lifecycle-related code outside of the browser env #169

Closed

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Jul 1, 2023

⚠️ This is just me tinkering with things. Feel free to close this right away.

My line of thinking here is that UI libraries tend to over ship code in node because it's not that easy to serve different codes in browsers and in node. However, a lot of the code that we ship is browser-only - for the server it's just redundant cruft. On the server we can't execute any effects, state is a one-off, etc etc. What if we just throw away client-specific code in node? With the current tooling setup this is actually fairly easy.

I don't expect those code changes to be 100% correct. I just put this together quickly without analyzing this deeply. I just wanted to learn how much we could roughly save by doing smth like this. The result ain't bad at all! With those changes, we go from 5601 bytes (min+gzipped) to 1691 bytes. That's a 70% reduction on the server side.

@vercel
Copy link

vercel bot commented Jul 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-resizable-panels ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2023 7:08pm

@bvaughn
Copy link
Owner

bvaughn commented Jul 2, 2023

⚠️ This is just me tinkering with things. Feel free to close this right away.

Understood 😄

Going to do that in this case. It's a neat thing to explore, but I think I'll pass on that level of optimization (for now)

@bvaughn bvaughn closed this Jul 2, 2023
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.

2 participants