Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte 5: Strange store behavior #10103

Closed
PatrickG opened this issue Jan 7, 2024 · 2 comments
Closed

Svelte 5: Strange store behavior #10103

PatrickG opened this issue Jan 7, 2024 · 2 comments
Assignees

Comments

@PatrickG
Copy link
Member

PatrickG commented Jan 7, 2024

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

@PatrickG PatrickG changed the title Svelte5: Strange store behavior Svelte 5: Strange store behavior Jan 7, 2024
@trueadm
Copy link
Contributor

trueadm commented Jan 8, 2024

This seems to work for me now?

@trueadm trueadm self-assigned this Jan 8, 2024
@PatrickG
Copy link
Member Author

PatrickG commented Jan 8, 2024

This seems to work for me now?

Yea, it works now. Thank you ❤️
Which PR fixed it? (I guess #10111)

@PatrickG PatrickG closed this as completed Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants