Skip to content

Svelte 5: Strange store behavior #10103

@PatrickG

Description

@PatrickG

Describe the bug

I've encountered this bug in a Sveltekit + Svelte 5 app.

Reproduction

The reproduction might be a bit confusing. I mimicked Sveltekit because otherwise I was not able to reproduce the bug.

Reproduction

Click the "Change page prop" button multiple times.
The test state in Layout.svelte stays true even tho the same expression in the $inspect rune does evaluate to false which you can see in the console.

Some strange things:

  • If you modify line 16 in App.svelte to be { a: 4, b: 'X' } - which leads to test being true when initialized - test is changing correctly (true -> false -> true -> etc.). But if you remove line 16 in Layout.svelte, line 14 will only rerender once.
  • If you modify the derived expression in Layout.svelte from $page.a === 4 || $page.b === 'Y' to $page.a === 4 (so test is still false when initialized), test is changing correctly as well. But still, if you remove line 16, line 14 will only rerender once.

Logs

No response

System Info

Svelte 5

Severity

blocking all usage of svelte

Metadata

Metadata

Assignees

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