Skip to content

Svelte 5: <title> breaks if object becomes undefined #10741

@Rich-Harris

Description

@Rich-Harris

Describe the bug

If you have something like this...

{#if post}
  <Seo {post} />
{/if}
<script>
  let { post } = $props();
</script>

<svelte:head>
  <title>{post.title}</title>
</svelte:head>

...then if post becomes null, the {post.title} render effect updates before the component is removed.

Probably makes sense to roll the fix into the #10594 work unless the fix is trivial.

Reproduction

preview link

Logs

No response

System Info

next

Severity

annoyance

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions