Skip to content

Miscompilation of bind:group when used with a Set #15715

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

Open
yamplum opened this issue Apr 9, 2025 · 2 comments
Open

Miscompilation of bind:group when used with a Set #15715

yamplum opened this issue Apr 9, 2025 · 2 comments

Comments

@yamplum
Copy link

yamplum commented Apr 9, 2025

Describe the bug

When trying to pass a Set to the bind:group directive, I get the following error: value.includes is not a function in App.svelte. Indeed, the correct method to check membership of a Set is has() rather than includes().

Using a Set in a bind:group seems like a natural use case and I didn't catch anything about this limitation in the docs, so I assume it is not intentional. I suspect it should be a relatively easy fix.

Potentially related mention of this(?) issue from 2020: #5721 (comment)

Reproduction

https://svelte.dev/playground/11b978c08eb34f06a499b7dc87e98672?version=5.25.9

I can't verify if it used to work in Svelte 4 because Svelte 4 playground doesn't work (Error compiling component: Unrecognized option 'runes').

Logs

System Info

System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M1
    Memory: 108.41 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.11.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - /opt/homebrew/bin/npm
    pnpm: 10.6.5 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 135.0.7049.42
    Safari: 18.3.1
  npmPackages:
    svelte: ^5.0.0 => 5.1.2

Severity

annoyance

@dummdidumm
Copy link
Member

bind:group only works with arrays, not sure if we should enhance that

@paoloricciuti
Copy link
Member

bind:group only works with arrays, not sure if we should enhance that

But how would that work? Try to check for includes and if it's not there try with has?

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

No branches or pull requests

3 participants