question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useStorage does not allow store 0 (falsey values in general)

See original GitHub issue

In my case 0 is the array index which it is rather common I think. Instead default value is used - https://github.com/antfu/vueuse/blob/master/packages/core/useStorage/index.ts#L9-L11

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vmihailencocommented, Feb 21, 2020

Seems to work fine - thank you!

1reaction
antfucommented, Feb 21, 2020

Hi @vmihailenco, I just release a new version x.0.19.

useStorage now supports objects and primitives, along with useLocalStorage and useSessionStorage. useStoragePlain is no longer needed 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

All falsey values in JavaScript - Stack Overflow
Truthy values that actually == false · "0" and '0' - they're non-empty strings, which are truthy, but Javascript's == matches numbers with...
Read more >
Falsy Values in JavaScript - freeCodeCamp
A falsy value is something which evaluates to FALSE, for instance when checking a variable. There are only six falsey values in JavaScript: ......
Read more >
CSC 415 Operating System Principles Unit 06 Flashcards
Which of the following is FALSE about swap space use? Select one: a. Swap space may be used to store only pages that...
Read more >
useStorage - VueUse
By default, useStorage will use the value from storage if it presents and ignores the default value. Be aware that when you adding...
Read more >
Falsy - MDN Web Docs Glossary: Definitions of Web-related ...
A falsy (sometimes written falsey) value is a value that is considered false when encountered in a Boolean context.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found