Skip to content

Commit d32b459

Browse files
committed
fix(useStorage): nullish check, close vueuse#272
1 parent 285046a commit d32b459

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/core/useStorage/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function useStorage<T extends(string|number|boolean|object|null)> (
9595

9696
try {
9797
let rawValue = storage.getItem(key)
98-
if (rawValue === undefined && defaultValue) {
98+
if (rawValue == null && defaultValue) {
9999
rawValue = Serializers[type].write(defaultValue)
100100
storage.setItem(key, rawValue)
101101
}

0 commit comments

Comments
 (0)