Skip to content

Better hydration #4308

Closed
@avi

Description

@avi

Is your feature request related to a problem? Please describe.
Currently hydration is very expensive, it searches for the correct node type clears it and re-adds the attributes and finally unmounts and remounts the DOM node by calling insertBefore/append
This causes iframes to reload.
In the current implementation setting the innerHTML to '' and doing client side render is faster and cleaner

Describe the solution you'd like
All DOM should be reused, attributes should not be cleared, and no node should be insertBefore/append unless there is an actual reason.
DOM nodes shouldn't be scanned for the correct nodeName - assume everything is in order on the first miss clear all the rest and start adding new nodes as needed
Text nodes need special treatment as they collapse in SSR

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

How important is this feature to you?
It is a deal breaker for us - we have quite a few iframes in use and using hydration in it's current form reloads them, it also slows our TTI. So we are stuck with either using only client-side rendering or picking a different solution

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions