This commit is contained in:
parent
598b6881e8
commit
5be22493fa
@ -18,7 +18,6 @@ type DatabaseLoaderProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function DatabaseLoader({ children }: DatabaseLoaderProps) {
|
export default function DatabaseLoader({ children }: DatabaseLoaderProps) {
|
||||||
const { toast } = useToast();
|
|
||||||
const [database, setDatabase] = useState<Database | undefined>(undefined);
|
const [database, setDatabase] = useState<Database | undefined>(undefined);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -28,12 +27,8 @@ export default function DatabaseLoader({ children }: DatabaseLoaderProps) {
|
|||||||
db.on("ready", () => {
|
db.on("ready", () => {
|
||||||
const loadTime = (performance.now() - before).toFixed(0);
|
const loadTime = (performance.now() - before).toFixed(0);
|
||||||
console.log(`Loaded database in ${loadTime}ms`);
|
console.log(`Loaded database in ${loadTime}ms`);
|
||||||
toast({
|
|
||||||
title: "Database loaded",
|
|
||||||
description: `The database was loaded in ${loadTime}ms.`,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}, [toast]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DatabaseContext.Provider value={database}>
|
<DatabaseContext.Provider value={database}>
|
||||||
|
Reference in New Issue
Block a user