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

False assignment_value_stale warning when storing state in class and using bind:group #14687

Open
Bladesheng opened this issue Dec 12, 2024 · 1 comment

Comments

@Bladesheng
Copy link

Bladesheng commented Dec 12, 2024

Describe the bug

I am getting the assignment_value_stale warning when I store state in a class and then bind that state to group of checkboxes. According to the docs, I believe in this case the warning is not relevant and should not be printed.
Everything else works as expected though.

When the state is not stored in a class, there is no warning (correct).

When $state.raw([]) is used instead, there is also no warning.

This feels similar to #14643

Reproduction

https://svelte.dev/playground/59525517cbb8474ca7db39aacfa98586?version=5.11.2

Logs

▶
[svelte] assignment_value_stale
Assignment to `selectedOptions` property (App.svelte:19:14) will evaluate to the right-hand side, not the value of `selectedOptions` following the assignment. This may result in unexpected behaviour.
https://svelte.dev/e/assignment_value_stale
eval
playground:output:4148:47
untrack
playground:output:2696:11
console.warn
playground:output:4148:16
assignment_value_stale
playground:output:476:12
compare
playground:output:2819:4
assign
playground:output:2832:10
eval
playground:output:4104:18

System Info

Svelte 5.11.2, Rocky Linux, chrome, firefox

Severity

annoyance

@Bladesheng Bladesheng changed the title False assignment_value_stale warning when storing state in class and using bind:group False assignment_value_stale warning when storing state in class and using bind:group Dec 12, 2024
@Leonidaz
Copy link

this is the same issue that I came across related to using a "workaround" for bind:group with the new syntax {get, set}.

via this comment: #14670 (comment)

Meanwhile, using state.raw gets rid of the warning.

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