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

ReferenceError while having #each inside a snippet #15531

Closed
MartinMikusat opened this issue Mar 17, 2025 · 0 comments · Fixed by #15534
Closed

ReferenceError while having #each inside a snippet #15531

MartinMikusat opened this issue Mar 17, 2025 · 0 comments · Fixed by #15534

Comments

@MartinMikusat
Copy link

MartinMikusat commented Mar 17, 2025

Describe the bug

While using #each inside a snippet, trying to pass the snippet as an argument to a function defined inside the component definition throws a "ReferenceError: x is not defined"

Passing it to a function defined inside an onclick handler of a button element still works

Removing the #each loop fixes the issue

Reproduction

https://svelte.dev/playground/646d5eeee3be4efca6f6a01dd89caf9d?version=5.23.0

Logs

System Info

System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M1
    Memory: 186.53 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 11.1.0 - /usr/local/bin/npm
    pnpm: 6.32.1 - /usr/local/bin/pnpm
    bun: 1.2.5 - ~/.bun/bin/bun
  Browsers:
    Chrome: 134.0.6998.89
    Safari: 18.3.1
  npmPackages:
    svelte: ^5.23.0 => 5.23.0

Severity

annoyance

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

Successfully merging a pull request may close this issue.

1 participant