Skip to content

Components are rendered twice within sveltekit.head #6216

@aubergene

Description

@aubergene

Describe the bug

I have a component Meta.svelte which is rendered within +layout.svelte. On page load (and SSR) the tags are rendered correctly, but on JS page navigation the tags are duplicated (which in Chrome means the second <title> is ignored)

<svelte:head>
	<Meta />
</svelte:head>
<script>
	import { page } from '$app/stores';

	let title;
	let description;

	$: {
		$page;
		title = Math.random();
		description = Math.random();
	}
</script>

<title>{title}</title>
<meta name="description" content={description} />

Reproduction

Made a demo app

https://github.com/aubergene/svelte-kit-head-bug

Logs

No response

System Info

System:
    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 126.55 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 92.0
    Safari: 15.6.1
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.65
    @sveltejs/kit: next => 1.0.0-next.431
    svelte: ^3.44.0 => 3.49.0
    vite: ^3.0.4 => 3.0.9

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions