useStorageLocal in dev and build mode
thanhnguyen0904 opened this issue · comments
Describe the bug
Hello guys, im having a issue when create a login page. I tried to console.log(storageDemo) in setup hook, in dev mode it prints correct value, but in build mode it always prints default value. You can see my screenshot below.
Please help, thanks in advance!
Reproduction
https://github.com/antfu/vitesse-webext/blob/refactor/mv3/src/popup/Popup.vue
System Info
System:
OS: macOS 13.2.1
CPU: (8) arm64 Apple M1
Memory: 526.91 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
Browsers:
Chrome: 111.0.5563.110
Firefox: 106.0
Safari: 16.3
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- The provided reproduction is a minimal reproducible of the bug.
im going a bit tricky by comunicate with background by sendMessage and it works, still expecting better solution though
it doesn't seem to be a problem, it depends on the order of rendering and storage accessing.
storageDemo
is a reactive value, if you want to get the latest value, use storage.local.get
, if you want to subscribe to the latest value, use watch
/watchEffect