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 $effect rune and untrack #13400

Closed
IOnlyNeedParenthesis opened this issue Sep 26, 2024 · 2 comments
Closed

Svelte 5 $effect rune and untrack #13400

IOnlyNeedParenthesis opened this issue Sep 26, 2024 · 2 comments

Comments

@IOnlyNeedParenthesis
Copy link

Describe the bug

The effect doesn't run when it's dependency changes.
Explaining would just be pseudocode so see https://github.com/IOnlyNeedParenthesis/svelte5-effect-untrack-repro/blob/main/src/routes/test/%2Bpage.svelte

Reproduction

https://github.com/IOnlyNeedParenthesis/svelte5-effect-untrack-repro

Logs

No response

System Info

System:
    OS: Linux 6.10 Arch Linux
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 4.30 GB / 15.40 GB
    Container: Yes
    Shell: 5.2.32 - /usr/bin/bash
  Binaries:
    bun: 1.1.29 - /tmp/bun-node-6d43b3662/bun
  npmPackages:
    svelte: ^5.0.0-next.1 => 5.0.0-next.259 

Browser is firefox

Severity

annoyance

@dummdidumm
Copy link
Member

This works as expected. You're reading value only in the else branch, which isn't picked up the first time. Hence the effect does not register value as a dependency, and so it never reruns. Make sure to read value in all branches.

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2024
@IOnlyNeedParenthesis
Copy link
Author

Thank you, now i understand.

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