-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Labels
enhancementNew feature or requestNew feature or requesthas prhas workaroundHas workaround to avoid this issueHas workaround to avoid this issue
Description
Describe the bug
When changing the storage key and then the ref containing the value synchronously, the new value is ignored and the ref contains the value from storage.
Here's what happens when changing both the useStorage
key and value synchronously:
- Set the
key
andvalue
. - The
key
watcher triggersupdate
. - The
update
function loads the value from the storage and sets thevalue
(data
). - The
data
watcher triggerswrite
. - The
write
function updates the storage with the value loaded from the storage in step 3 (not expected), rather than with the value explicitly set in step 1 (expected).
Reproduction
System Info
System:
OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
Memory: 4.10 GB / 15.34 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 22.14.0 - /run/user/1000/fnm_multishells/5676_1747894241665/bin/node
npm: 10.9.2 - /run/user/1000/fnm_multishells/5676_1747894241665/bin/npm
pnpm: 10.10.0 - /run/user/1000/fnm_multishells/5676_1747894241665/bin/pnpm
Browsers:
Chrome: 135.0.7049.114
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.
sanjay-bhuva and OrbisK
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthas prhas workaroundHas workaround to avoid this issueHas workaround to avoid this issue