Cannot update state property via $patch with empty object #2242
-
ReproductionNA Steps to reproduce the bugUsing Vue 2, Update a state item object to an empty object in a Vue page:
with store:
Expected behavior
Actual behavior
Additional informationNA |
Beta Was this translation helpful? Give feedback.
Answered by
posva
Dec 11, 2023
Replies: 1 comment 1 reply
-
Same behavior with UPDATE: I switched to using the 2nd method https://pinia.vuejs.org/core-concepts/state.html#Mutating-the-state and this worked. Not sure why it acts differently but it works.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$patch()
tries to recursively merge objects, therefore, an empty object doesn't change anything. Using the function syntax or directly changing the property is the correct way