Answer the question
In order to leave comments, you need to log in
Why does Vuex need rootState to be a reference to an object, not a copy of it?
There is a problem in the repository related to the fact that the rootState in actions is a reference to the object, and not a copy of it
https://github.com/vuejs/vuex/issues/1939
https://codesandbox.io/s/dank-https-tqtvo ?file=/sr... (You can have a look here)
Trying to fix this, I ran into a test error,
Expected: {"a": 1, "four": {"a": 6}, "nested": {"a": 2, "nested": {"three": {"a": 5}, "two": {"a": 4}}, "one": {"a": 3}}}
Received: serializes to the same string
269 | calls++
270 | expect(state.a).toBe(n)
> 271 | expect(rootState).toBe(store.state)
| ^
272 | }
273 | }
274 | }
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question