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

Hydration Re-Renders Entire DOM #1067

Closed
shancarter opened this issue Jan 2, 2018 · 9 comments · Fixed by #6204
Closed

Hydration Re-Renders Entire DOM #1067

shancarter opened this issue Jan 2, 2018 · 9 comments · Fixed by #6204

Comments

@shancarter
Copy link

shancarter commented Jan 2, 2018

When composing a simple example of a static ssr page with client-side hydration, the client code re-renders the entire DOM rather than just making in-place modifications. Each node seems to be removed and re-created.

Example setup is here with mutation observers: https://github.com/distillpub/svelte-template

GIF of the behavior in action below:

hydrate

@arxpoetica
Copy link
Member

Is this discussion (on Gitter) also relevant? https://gitter.im/sveltejs/svelte?at=5a4ffa5c290a1f456153eb2f You're talking about component-level hydration?

@FaustTobias
Copy link

Any updates on this? This still happens and is annoying when working with animations since all css animations are restarted after the hydration.

@tcrowe
Copy link
Contributor

tcrowe commented Oct 24, 2019

I was talking with a guy in the chat about hydrate and we thought it would only update if something changed but it might re-paint everything!

I made two mov video files here showing the effect. They are named "unecessary-repaint" but in truth it may be necessary to repaint but I think we can avoid it. =]

https://github.com/tcrowe/svelte-hydrate-test/blob/master/repaint-tests-2019-10-24.md

I delayed the paint in svelte and sapper 1sec and refreshed a number of times.

@shancarter @FaustTobias Can you see if this is the same repaint you were looking at some months back?

Thanks! 🙏

@benmccann
Copy link
Member

This looks like a duplicate of #4308. (well technically that one's the duplicate since this one was around first, but I think keeping the other would be more useful since it has a PR and a bunch of upvotes)

@Conduitry
Copy link
Member

Hydration performance should be significantly improved in 3.38.0 by way of #6204.

@LukeCarlThompson
Copy link

LukeCarlThompson commented May 1, 2021

I just updated a Sapper app with this latest Svelte version (3.38.0) and found it is now actually duplicating some of the elements on my homepage. It appears like they are created once on the server and then added again on the client side without removing the server created versions. Any html elements I add in are duplicated, but not components.

Not sure if this issue is related to Sapper though.

Unfortunately I am not able to create an isolated example at this time, but will at the next available opportunity.

@johngrasty
Copy link

@LukeCarlThompson I’m seeing the same thing with 3.38 and svelte-kit, so it’s not just sapper, and it’s not just you. I likewise haven’t been able to isolate it yet either.

@benmccann
Copy link
Member

Fixed in 3.38.1

@benmccann
Copy link
Member

There was another bug, so the performance improvement was reverted. I'm going to leave this closed as a duplicate of #4308 and we can track getting the performance improvement reimplemented in that issue

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

Successfully merging a pull request may close this issue.

9 participants