update storage provider

This commit is contained in:
reya 2023-11-22 09:05:10 +07:00
parent 1929ceb72d
commit b73d84fccb

View File

@ -20,7 +20,7 @@ const StorageContext = createContext<StorageContext>({
db: undefined,
});
const StorageProvider = ({ children }: PropsWithChildren<object>) => {
const StorageInstance = () => {
const [db, setDB] = useState<LumeStorage>(undefined);
const [isNewVersion, setIsNewVersion] = useState(false);
@ -75,6 +75,12 @@ const StorageProvider = ({ children }: PropsWithChildren<object>) => {
if (!db) initLumeStorage();
}, []);
return { db, isNewVersion };
};
const StorageProvider = ({ children }: PropsWithChildren<object>) => {
const { db, isNewVersion } = StorageInstance();
if (!db)
return (
<div