Skip to content

Inefficient code created for hydration of static componentsΒ #7226

Closed
@benmccann

Description

@benmccann

Describe the bug

If there's a big block of static HTML or even the entire component is static, the Svelte compiler still creates a separate variable for every element when hydratable: true. Compare to when hydratable: false and it will just set the entire block with innerHTML. This results in worse time-to-interactive on blogs with large posts using MDSveX, which is a fairly common use case - though this example is a particularly large one.

This is yet another reason we would benefit from something like repair: false: #780 (comment)

Reproduction

https://svelte.dev/repl/a197647b669249f0a1d7a249b7c00044?version=3.46.4

Turn the hydratable flag to true and the output JS will have 10x as many lines. It both takes longer to transfer over the network and longer to run after it's been transferred

Logs

No response

System Info

Svelte 3.46.4

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions