Skip to content

initializing store w/ this.$state not updating state on store instance #681

Discussion options

You must be logged in to vote

This seems like a regression to me, the code comment for $state does say:

State of the Store. Setting it will replace the whole state.

That evidently worked before but seems to break reactivity now if you do assign it.
My suggestion would be to create an issue for this.

However as a quick fix, you can instead use $patch which achieves the same result without breaking reactivity:

// change the following
this.$state = data
// to this
this.$patch(data)

Forked Sandbox

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tomschulze
Comment options

Answer selected by tomschulze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants