Skip to content

svelte:head repeated in SSR possibly due to bindings/$$settled logic #4982

@gushogg-blake

Description

@gushogg-blake

I haven't been able to create a simple repro for this unfortunately.

Tags inside <svelte:head> are being repeated in SSR output so any scripts defined there are getting loaded twice, e.g.:

<head>
    <script src="/script.js"></script>
    <script src="/script.js"></script>
</head>

A console.trace from the top-level <script> of the component that has the <svelte:head> block indicates that that component is being "called" twice also. The trace stack leads to a do-while loop in the callback passed to internal.create_ssr_component, which seems to be implementing logic for repeatedly rendering components until the values of bound props are resolved ($$settled).

The code that directly causes the repetition seems to be $$result.head += ... added by src/compiler/compile/render_ssr/handlers/Head.ts.

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