Development #24

Merged
kyle merged 35 commits from development into main 2026-08-28 10:40:10 -05:00
2 changed files with 15 additions and 5 deletions
Showing only changes of commit 96d5535293 - Show all commits
+3
View File
@@ -53,12 +53,14 @@ export function Countdown({ date, label, color }: CountdownProps) {
return (
<Group gap="xs">
{label && <Text size='sm' fw={500}>{label}:</Text>}
{/* Server and client render different seconds; the first client tick corrects it. */}
<Text
size='sm'
fw={600}
c={isFinalStretch ? 'red' : color}
ff="monospace"
className={classes.time}
suppressHydrationWarning
>
{prefix}
<span
@@ -66,6 +68,7 @@ export function Countdown({ date, label, color }: CountdownProps) {
className={`${classes.seconds} ${
isFinalStretch ? classes.finalTick : classes.tick
}`}
suppressHydrationWarning
>
{pad(timeLeft.seconds)}
</span>
+12 -5
View File
@@ -20,6 +20,8 @@ const INVALIDATE_JITTER_MS = 1500;
const invalidateTimers = new Map<string, ReturnType<typeof setTimeout>>();
const WATCHDOG_MS = 45_000;
const REFRESH_ATTEMPT_COOLDOWN_MS = 60_000;
let lastRefreshAttemptAt = 0;
function debouncedInvalidate(
queryClient: ReturnType<typeof useQueryClient>,
@@ -163,12 +165,17 @@ export function useServerEvents() {
// an expired session rather than a network blip. Try to refresh; if the
// session is genuinely gone, stop retrying so we don't hammer the
// endpoint forever — a real re-login (or a wake event) will reconnect.
// Cooldown: a flaky stream (proxy idle timeouts) must not turn every
// reconnect into a refresh call.
let sessionValid = true;
try {
const { attemptRefreshingSession } = await import('supertokens-web-js/recipe/session');
sessionValid = await attemptRefreshingSession();
} catch {
// Refresh call itself failed (likely offline) — treat as transient.
if (Date.now() - lastRefreshAttemptAt > REFRESH_ATTEMPT_COOLDOWN_MS) {
lastRefreshAttemptAt = Date.now();
try {
const { attemptRefreshingSession } = await import('supertokens-web-js/recipe/session');
sessionValid = await attemptRefreshingSession();
} catch {
// Refresh call itself failed (likely offline) — treat as transient.
}
}
if (disposed) return;