add db load time in the toast
All checks were successful
Deploy / deploy (push) Successful in 4m21s

This commit is contained in:
Lee 2024-10-01 15:49:38 +01:00
parent f30a373120
commit cdaf16b157
4 changed files with 8 additions and 8 deletions

@ -12,7 +12,7 @@ export default class Database extends Dexie {
settings!: EntityTable<Settings, "id">; settings!: EntityTable<Settings, "id">;
/** /**
* BeatSaver maps * Cached BeatSaver maps
*/ */
beatSaverMaps!: EntityTable<BeatSaverMap, "hash">; beatSaverMaps!: EntityTable<BeatSaverMap, "hash">;
@ -58,7 +58,7 @@ export default class Database extends Dexie {
* @returns the settings * @returns the settings
*/ */
async getSettings(): Promise<Settings | undefined> { async getSettings(): Promise<Settings | undefined> {
return await this.settings.get(SETTINGS_ID); return this.settings.get(SETTINGS_ID);
} }
/** /**
@ -68,7 +68,7 @@ export default class Database extends Dexie {
* @returns the settings * @returns the settings
*/ */
async setSettings(settings: Settings) { async setSettings(settings: Settings) {
return await this.settings.update(SETTINGS_ID, settings); return this.settings.update(SETTINGS_ID, settings);
} }
} }

@ -26,7 +26,7 @@ export default function DatabaseLoader({ children }: Props) {
db.on("ready", () => { db.on("ready", () => {
toast({ toast({
title: "Database loaded", title: "Database loaded",
description: "The database was loaded successfully.", description: `The database was loaded in ${performance.now() - before}ms.`,
}); });
}); });
}, [toast]); }, [toast]);

@ -24,17 +24,17 @@ type Props = {
}; };
export default function PlayerData({ export default function PlayerData({
initialPlayerData: initalPlayerData, initialPlayerData: initialPlayerData,
initialScoreData, initialScoreData,
initialSearch, initialSearch,
sort, sort,
page, page,
}: Props) { }: Props) {
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const miniRankingsRef = useRef<any>(); const miniRankingsRef = useRef<HTMLDivElement>(null);
const isMiniRankingsVisible = useIsVisible(miniRankingsRef); const isMiniRankingsVisible = useIsVisible(miniRankingsRef);
let player = initalPlayerData; let player = initialPlayerData;
const { data, isLoading, isError } = useQuery({ const { data, isLoading, isError } = useQuery({
queryKey: ["player", player.id], queryKey: ["player", player.id],
queryFn: () => scoresaberService.lookupPlayer(player.id), queryFn: () => scoresaberService.lookupPlayer(player.id),

@ -5,7 +5,7 @@ import { useEffect, useState } from "react";
* *
* @param ref the ref of the element * @param ref the ref of the element
*/ */
export function useIsVisible(ref: any) { export function useIsVisible(ref: React.RefObject<HTMLElement>) {
const [isIntersecting, setIntersecting] = useState(false); const [isIntersecting, setIntersecting] = useState(false);
useEffect(() => { useEffect(() => {