fix(editor): Fix local storage flags defaulting to undefined string (#7603)

useStorage takes the default value `undefined` and sets it in local
storage.. also returns "undefined" as string which breaks onboarding
flows

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Mutasem Aldmour
2023-11-07 10:06:08 +01:00
committed by GitHub
parent 78b84af8d1
commit 151e60f829
12 changed files with 97 additions and 42 deletions

View File

@@ -0,0 +1,13 @@
import { useStorage as useStorageComposable } from '@vueuse/core';
import type { Ref } from 'vue';
export function useStorage(key: string): Ref<string | null> {
const data = useStorageComposable(key, null, undefined, { writeDefaults: false });
// bug in 1.15.1
if (data.value === 'undefined') {
data.value = null;
}
return data;
}