mirror of
https://github.com/luminous-devs/lume.git
synced 2024-10-02 18:00:47 +00:00
update storage provider
This commit is contained in:
parent
1929ceb72d
commit
b73d84fccb
@ -20,7 +20,7 @@ const StorageContext = createContext<StorageContext>({
|
|||||||
db: undefined,
|
db: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const StorageProvider = ({ children }: PropsWithChildren<object>) => {
|
const StorageInstance = () => {
|
||||||
const [db, setDB] = useState<LumeStorage>(undefined);
|
const [db, setDB] = useState<LumeStorage>(undefined);
|
||||||
const [isNewVersion, setIsNewVersion] = useState(false);
|
const [isNewVersion, setIsNewVersion] = useState(false);
|
||||||
|
|
||||||
@ -75,6 +75,12 @@ const StorageProvider = ({ children }: PropsWithChildren<object>) => {
|
|||||||
if (!db) initLumeStorage();
|
if (!db) initLumeStorage();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
return { db, isNewVersion };
|
||||||
|
};
|
||||||
|
|
||||||
|
const StorageProvider = ({ children }: PropsWithChildren<object>) => {
|
||||||
|
const { db, isNewVersion } = StorageInstance();
|
||||||
|
|
||||||
if (!db)
|
if (!db)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
Loading…
Reference in New Issue
Block a user