-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Binding to store value properties causes addition change per binding #5555
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
Comments
This actually seems to be a pretty annoying bug. It doesn't apply only to stores. Binding all complex structures (objects, arrays) fires another extra update. Here's a link to my simplified REPL. https://svelte.dev/repl/2bbb8d98fc8a49398d269dff0eb9843b?version=3.29.7 @techniq If you may, please update the bug title to something more straightforward, so as it gets more attention. |
This should be fixed now in 3.32.2 - https://svelte.dev/repl/83c80ca45be54486ae7fd15827660280?version=3.32.2 |
I can confirm the fix. Many thanks! <3 |
Confirmed as well. Thanks @pushkine and @Conduitry! |
I believe a variation of this bug may still exists. https://svelte.dev/repl/894cc9ff89634c81b83b3b4807326704?version=3.38.3 |
Why does it trigger if I put it in the OnMount ? Shouldn't it trigger on changes, instead on initialisation ? |
I think this is still not fixed: #6590 |
Yep I can confirm. It is still actual! |
This issue was about |
@pushkine Hi, can you elaborate a bit more on why it will be never fixed? I traced this problem up to this piece of code here and I honestly don't understand the greater logic behind this. #4265 (comment) |
This bug is not fixed. It's really frustrating... |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
When binding to a property of a store value, the value is updated / changed (subscribe called) for each bind statement, instead of just once for the initialization.
To Reproduce
REPL: https://svelte.dev/repl/83c80ca45be54486ae7fd15827660280?version=3.29.0
In the REPL, I would expect "pagination changed!" to be logged once when initialized, but it is being logged 3 times (2 additional times due to each
bind:
).After the initial 3, only a single subscribe is called when changing anything on the store, as expected.
Expected behavior
I would expect a single call to
subscribe
on initialization, instead of1 + (number of `bind:` properties)
Information about your Svelte project:
Severity
In my application, this is causing all my HTTP requests to fire multiple times on init due to the changing store value, which makes this a rather significant issue for my project.
The text was updated successfully, but these errors were encountered: