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">;
/**
* BeatSaver maps
* Cached BeatSaver maps
*/
beatSaverMaps!: EntityTable<BeatSaverMap, "hash">;
@ -58,7 +58,7 @@ export default class Database extends Dexie {
* @returns the settings
*/
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
*/
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", () => {
toast({
title: "Database loaded",
description: "The database was loaded successfully.",
description: `The database was loaded in ${performance.now() - before}ms.`,
});
});
}, [toast]);

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

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