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

Legacy #await problem #14351

Open
valmarv opened this issue Nov 18, 2024 · 3 comments
Open

Legacy #await problem #14351

valmarv opened this issue Nov 18, 2024 · 3 comments
Labels

Comments

@valmarv
Copy link

valmarv commented Nov 18, 2024

Describe the bug

Await block unexpectedly evaluates expression upon state changes in legacy mode.
Expected behavior is to only have the expression evaluated when its variables change.

Reproduction

https://svelte.dev/playground/53cc8a72175c41c6bebb2bbb75d069a7?version=5.2.3

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
    Memory: 9.01 GB / 25.53 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
    npm: 9.1.3 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (130.0.2849.80)
    Internet Explorer: 11.0.19041.4355
  npmPackages:
    rollup: ^4.22.4 => 4.27.3
    svelte: ^5.1.6 => 5.2.3

Severity

blocking an upgrade

@trueadm trueadm added the bug label Nov 19, 2024
@patrikpessi
Copy link

patrikpessi commented Nov 26, 2024

I ran into the same problem and worked around it by turning the function calls into plain promises like so
https://svelte.dev/playground/1c7393b8c9a5457f8261ec65c33fdf48?version=5.2.8

@dummdidumm
Copy link
Member

cnt becomes a dependency of the await block by being read inside init, and that causes the await block to rerun. We likely need to wrap these calls in untrack in legacy mode

@valmarv
Copy link
Author

valmarv commented Nov 26, 2024

@dummdidumm What exactly is this dependency tracking, when does it come up? Function calls haven't been invalidated by dependencies in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants