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
useStorage - v9.8.2 introduced breaking change - watcher on nested object triggered despite not changed #2782
Comments
I can confirm the behavior. |
I think this may be related to this issue as well, which still appears to be a problem in the latest release. |
I have a not similar but related problem. When used with the Module Federation, the useStore becomes non-reactive |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The problem persists. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The problem persists. |
"@vueuse/core": "10.4.1", has a similar issue described here #3312. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Well the fix that closed this ticket now prevents useStorage from reading the current value in storage when creating the reactive value. useLocalStorage will be return a reference with an undefined value even if there is a value in the backing store. I'll try to make a repro repo for it and file a ticket soon. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Describe the bug
We just updated @vueuse/core from v.9.6.0 to 9.12.0 and it seems like there is a breaking change introduced in v9.8.2 likely to be a bug.
We have a scenario where we store an object in the form of
{ one: { name: "foo" }, two: { name: "bar" } }
in local storage using useStorage.Then we have a watcher on
storage.value.one
which resetsstorage.value.two
to undefined.Then we have a watcher on
storage.value.two
doing something elseThen we have some select fields updating
storage.value.one
andstorage.value.two
With v9.6.0 when updating
storage.value.two
only the watcher onstorage.value.two
would be called as one would expect.With version >= 9.8.2 however the watcher for
storage.value.two
is called 2 timesthen the watcher for
storage.value.one
is called, resettingstorage.value.two
to undefinedthen the watcher for
storage.value.two
is called again, with a new value of undefinedand funny thing,
storage.value.two
in local storage is not even resetted 😃Reproduction
https://codesandbox.io/s/twilight-sea-33kwm3?file=/src/App.vue
System Info
vue: 3.2.45 @vueuse/core: >= 9.8.2 Browser: Google Chrome Version 110.0.5481.78 (Offizieller Build) (64-Bit)
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: