From b73d84fccba049f64d76481d79ef893aa156a497 Mon Sep 17 00:00:00 2001 From: reya Date: Wed, 22 Nov 2023 09:05:10 +0700 Subject: [PATCH] update storage provider --- src/libs/storage/provider.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/storage/provider.tsx b/src/libs/storage/provider.tsx index c888f9cd..e28b3a50 100644 --- a/src/libs/storage/provider.tsx +++ b/src/libs/storage/provider.tsx @@ -20,7 +20,7 @@ const StorageContext = createContext({ db: undefined, }); -const StorageProvider = ({ children }: PropsWithChildren) => { +const StorageInstance = () => { const [db, setDB] = useState(undefined); const [isNewVersion, setIsNewVersion] = useState(false); @@ -75,6 +75,12 @@ const StorageProvider = ({ children }: PropsWithChildren) => { if (!db) initLumeStorage(); }, []); + return { db, isNewVersion }; +}; + +const StorageProvider = ({ children }: PropsWithChildren) => { + const { db, isNewVersion } = StorageInstance(); + if (!db) return (