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: Add ability to manually specify dependencies for $effect rune #13207

Closed
kyoshino opened this issue Sep 11, 2024 · 1 comment
Closed

Comments

@kyoshino
Copy link
Contributor

Describe the problem

Dependencies are always unclear in Svelte, and Svelte 5 has causes some new infinite loops as mentioned in #13192. See also #12908.

Describe the proposed solution

Just like useEffect in React, I would like to use the optional second argument of the $effect rune to specify dependencies and untrack other states:

$effect(() => {
  // your logic
}, [a, b, c]);

Basically this is a shorthand of:

$effect(() => {
  void a;
  void b;
  void c;
  untrack(() => {
    // your logic
  });
});

(I usually use void to explicitly specify dependencies)

Importance

would make my life easier

@dummdidumm
Copy link
Member

Closing as duplicate of #9248

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 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