Skip to content

Hydration removes <title> element #4310

@Conduitry

Description

@Conduitry

Describe the bug
When starting from SSR generated HTML with hydratable: true, hydration will remove the <title> element along with the other appropriate <head> elements, but will not add it back.

Logs
None.

To Reproduce
https://github.com/johnmuhl/svelte-hydrate-head

Expected behavior
The <title> should remain after hydration.

Stacktraces
None.

Information about your Svelte project:
Independent of browser.
Svelte 3.17.0+

Severity
Pretty bad.

Additional context
This was introduced in #4082. The compiled component sets document.title first and then later removes elements matching [data-svelte="svelte-..."], and so the title is lost. The simplest way to handle this would probably be to not add the special SSR attribute to the <title> element at all, since as of #4250 we don't need to worry about there being more than one of that anyway.

cc @johnmuhl @tanhauhau

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