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

Reactivity doesn't work for store with nested array when referenced by $ #6765

Closed
juliancox opened this issue Sep 24, 2021 · 4 comments
Closed

Comments

@juliancox
Copy link

Describe the bug

Reactivity is broken for a store that is an object with a nested array eg: store = writable({arr: [{a: 1}]) if that array is referenced by the store $ notation eg {#each $store.arr as item}
replacing $ with get works as expected eg: {#each get(store).arr as item}

Reproduction

https://svelte.dev/repl/4bc891afdcf543d482ca1a14d2d23fc4?version=3.20.1

Logs

No response

System Info

System:
    OS: macOS 11.5.2
    CPU: (8) arm64 Apple M1
    Memory: 115.48 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v14.17.3/bin/yarn
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.3/bin/npm
  Browsers:
    Chrome: 93.0.4577.82
    Edge: 93.0.961.52
    Firefox: 92.0
    Safari: 14.1.2
  npmPackages:
    svelte: ^3.35.0 => 3.42.5

Severity

annoyance

@Addeuz
Copy link

Addeuz commented Sep 24, 2021

That's weird, it works for me in this REPL I just created because I'm opening an issue shortly about another problem I had about similar objects being updated in a store even though I'm only binding one.

I have svelte v3.34.0 but that should not matter.

@rmunn
Copy link
Contributor

rmunn commented Sep 24, 2021

The reproduction REPL is using an old version of Svelte: https://svelte.dev/repl/4bc891afdcf543d482ca1a14d2d23fc4?version=3.20.1

Change the version to version=3, which will automatically pull the latest version of Svelte 3.x, and all the "not reactive" examples become reactive as they should be: https://svelte.dev/repl/4bc891afdcf543d482ca1a14d2d23fc4?version=3

So I think this is a bug that's already been fixed and you're just using a version of Svelte from before the bug was fixed.

@Conduitry
Copy link
Member

Indeed, this was fixed a year ago in 3.25.0, and sounds like #5286. Please only open issues about the current version of Svelte.

@juliancox
Copy link
Author

Doh!, Sorry about that. Maybe adding a banner to repl when not on the latest version would stop dolts like me wasting everyone's time.

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

4 participants