TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Hydration is pure overhead

79 pointsby steve8708about 3 years ago

8 comments

chasd00about 3 years ago
This is confusing to me. From the article it sounds like the javascript is run on the server producing markup. That markup is sent to the browser for rendering then the javascript is requested by the browser. When the javascript arrives it is run again on the browser to re-generate the DOM with event handlers attached. If that is correct then why is the javascript run on the server to begin with and not just sent directly to the browser?<p>Is the idea to take advantage of the server&#x27;s horsepower to get something on the screen fast by sending pre-rendered HTML and then wait while the browser runs the code to basically re-create the page for interactivity?<p>(it&#x27;s been a while since i&#x27;ve done traditional front-end web dev)
评论 #31102362 未加载
评论 #31102946 未加载
评论 #31104192 未加载
评论 #31102044 未加载
评论 #31103838 未加载
评论 #31102635 未加载
评论 #31102644 未加载
评论 #31102604 未加载
评论 #31102637 未加载
yborisabout 3 years ago
For reference, Miško Hevery, the author of this post, is the creator of <i>Angular</i>.<p>At the end of the article, there&#x27;s his solution: <a href="https:&#x2F;&#x2F;qwik.builder.io&#x2F;guide&#x2F;overview" rel="nofollow">https:&#x2F;&#x2F;qwik.builder.io&#x2F;guide&#x2F;overview</a><p>&gt; Qwik is a new kind of web framework that can deliver instant loading web applications at any size or complexity. Your sites and apps can boot with less than 1kb of JS
评论 #31102703 未加载
programmarchyabout 3 years ago
If I&#x27;m understanding correctly, this is binding event handlers &quot;just in time&quot; instead of when a component initializes. Isn&#x27;t that just a tradeoff between working the CPU at load time vs. working the CPU on user interaction?<p>This doesn&#x27;t seem like a great tradeoff to me. Sure, maybe you save time during component initialization, but while that is happening the user is digesting the information anyway. Then once they make their decision to act, there&#x27;s no extra delay to produce the next state. However, with a &quot;just in time&quot; event binding, now the user has to wait (slightly) longer after they&#x27;ve already made their decision, which seems worse.
评论 #31102698 未加载
评论 #31102255 未加载
legymabout 3 years ago
The company I work for is making a big deal about client-side hydration. We use nextjs for our sites. My director was asking about Svelte.<p>&quot;Something i wanted to mention is both the React team and nextjs team are aware of this and are working on a solution to address needing to load Javascript on the client. Its called React Server Components<p>React Server Components Documentation <a href="https:&#x2F;&#x2F;reactjs.org&#x2F;blog&#x2F;2020&#x2F;12&#x2F;21&#x2F;data-fetching-with-react-server-components.html" rel="nofollow">https:&#x2F;&#x2F;reactjs.org&#x2F;blog&#x2F;2020&#x2F;12&#x2F;21&#x2F;data-fetching-with-react...</a><p>Nextjs Blog on Server Components <a href="https:&#x2F;&#x2F;vercel.com&#x2F;blog&#x2F;everything-about-react-server-components" rel="nofollow">https:&#x2F;&#x2F;vercel.com&#x2F;blog&#x2F;everything-about-react-server-compon...</a><p>Nextjs Documentation on Server Components (Alpha) <a href="https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;advanced-features&#x2F;react-18&#x2F;server-components" rel="nofollow">https:&#x2F;&#x2F;nextjs.org&#x2F;docs&#x2F;advanced-features&#x2F;react-18&#x2F;server-co...</a><p>We can try it out today on a platform that supports a node environment. This is from nextjs docs. I have a few thoughts on Svelte, but just wanted to point this out!&quot;<p>With Server Components, there&#x27;s zero client-side JavaScript needed, making page rendering faster.
评论 #31102184 未加载
评论 #31102147 未加载
wonnageabout 3 years ago
This article complains that downloading stuff is slow and then goes on to propose a solution where you have to wait for stuff to download before firing a scroll handler.
评论 #31106111 未加载
CreepGinabout 3 years ago
While we are on the topic of browser event handlers and &quot;embracing how browser actually work&quot;, I can&#x27;t help but mention that the builder.io website&#x27;s top navbar cannot handle ctrl + clicking (for opening links in a new tab).<p>It&#x27;s actually quite subtle. Sometimes it works, sometimes it doesn&#x27;t, depending on which page you are on, what you&#x27;ve already clicked, etc. All part of the fun of frontend web development, ain&#x27;t it?
评论 #31106089 未加载
评论 #31105594 未加载
scotty79about 3 years ago
It seems like just trading pre-loading for lag on first interaction and trading bundling stuff int as few requests as possible for many smaller requests with their respective headers.<p>I mean it&#x27;s fine to have choice about this trade-offs but you can do it right now just by splitting your application into parts and hydrating only the part the user interacts with. Which gives you additional flexibility of automatically hydrating the part the user is most likely to use and hydrating others in the background in the periods of user inactivity.<p>Also this article focuses very much on event handlers, but main part of hydration is creation of dynamic structures that allow the application to re-render dynamically and efficiently, sometimes swapping out large parts of page contents that are not delivered with initial pre-rendered HTML.<p>If you really wanted to improve the situation one could work on introducing partial hydration on demand into React and work on ways to serialize most of internal structures of React apps like virtual dom, so they can be passed along with the pre-rendered HTML to make the remaining requests lighter.<p>Creating new framework is way less impactful.
recursivedoubtsabout 3 years ago
Sometimes you just have to laugh.<p>We&#x27;ve been doing SSR all along, folks: server side templates.<p>Yeah, HTML was pretty hamstrung as a hypermedia, which made for mediocre UX, but that&#x27;s been fixed by libraries like unpoly, hotwire, or, my own, htmx.
评论 #31102629 未加载
评论 #31101755 未加载
评论 #31102128 未加载
评论 #31102659 未加载
评论 #31102294 未加载