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

[@vue/reactivity] effect() and computed() should not react to changes in a Map's values() when only keys() was ever accessed #877

Closed
nmsmith opened this issue Mar 24, 2020 · 0 comments

Comments

@nmsmith
Copy link

nmsmith commented Mar 24, 2020

Version

3.0.0-alpha.9

Reproduction link

https://jsfiddle.net/kxy9bued/1/

Steps to reproduce

See code sample. To summarise:

  • Create a reactive() Map.
  • Create an effect() wherein (only) the keys() of the Map are accessed.
  • Use set() to update an existing entry in the Map. The effect() is re-invoked, even though the keys() haven't changed.

Note that this makes the behaviour of a Map different to that of a Set, even if the Map is merely used as a Set.

What is expected?

The behaviour of a Map should match that of a Set. Specifically, when a Map key is UPDATED, rather than newly added, effect() should not react as if the list of keys() has changed.

What is actually happening?

The effect() is re-invoked, as if the list of keys() has changed. In the code sample, this causes an extra line of output to be printed.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant