Skip to content

Svelte 5: component hydration not repairing/removing target child elements #10375

@jonathonadams

Description

@jonathonadams

Describe the bug

As per the v4 Client API docs, a component can be created with the hydrate: true option to repair and remove existing child elements of the target.

The v5 breaking changes docs state that the compiler option hydratable has bees removed and all components are now hydrated and components are now created with createRoot or mount. Neither of these functions accept hydrate: true as an option.

When using createRoot or mount in v5, child elements of target are left unchanged. The expected behaviour is that of v4 (with hydrate: true) and DOM elements are repaired/removed.

Possibly related

#9827, #10332

Reproduction

minimum repo

Logs

No response

System Info

System:
    OS: macOS 14.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 66.25 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.local/share/mise/installs/node/20/bin/node
    npm: 10.1.0 - ~/.local/share/mise/installs/node/20/bin/npm
  Browsers:
    Brave Browser: 116.1.57.47
    Chrome: 120.0.6099.71
    Safari: 17.1
  npmPackages:
    svelte: ^5.0.0-next.45 => 4.2.9


### Severity

blocking an upgrade

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