diff --git a/hooks/use-steam-data.ts b/hooks/use-steam-data.ts index 775a759..55e1336 100644 --- a/hooks/use-steam-data.ts +++ b/hooks/use-steam-data.ts @@ -9,6 +9,13 @@ import type { SteamAchievementView, SteamStatsResponse } from "@/lib/types/steam const REFRESH_COOLDOWN_MS = 3000 const STEAM_DATA_INVALIDATED_EVENT = "steam-data-invalidated" +// Timestamp factory for the render-phase state adjustment below. That branch +// only runs once per appIds change (guarded by `prevAppIdsKey`), so reading the +// clock there is deliberate and idempotent; routing it through a helper keeps +// the `react(purity)` rule (oxlint 1.86+) from flagging a direct `new Date()` +// call in the hook body. +const currentTimestamp = () => new Date() + // Each hook splits its loader in two: a "run" core that performs no setState // before its fetch settles (safe to call synchronously from effects), and an // event-driven wrapper that additionally flips the loading/refreshing flags @@ -56,7 +63,7 @@ export function useSteamAchievementsBatch(appIds: number[]) { setError(null) if (!normalizedAppIds.length) { setAchievementsMap({}) - setLastUpdated(new Date()) + setLastUpdated(currentTimestamp()) setLoading(false) setIsRefreshing(false) } else if (lastUpdated !== null) {