diff --git a/backend/src/modules/timers/routes.ts b/backend/src/modules/timers/routes.ts index 80085dc..160bacd 100644 --- a/backend/src/modules/timers/routes.ts +++ b/backend/src/modules/timers/routes.ts @@ -150,7 +150,7 @@ export async function timerRoutes(app: FastifyInstance) { const active = timers.filter(t => t.state === 'active' || t.state === 'warning').length; const pending = timers.filter(t => t.state === 'paused').length; const lastSyncedAt = timers[0]?.lastSyncedAt ?? null; - const conflictCount = timers.filter(t => t.syncVersion === 0).length; + const unsyncedCount = timers.filter(t => t.lastSyncedAt == null).length; return { userId: auth.sub, @@ -158,7 +158,7 @@ export async function timerRoutes(app: FastifyInstance) { totalTimers: timers.length, active, pending, - conflictCount, + unsyncedCount, lastSyncedAt, generatedAt: new Date().toISOString(), }; diff --git a/web/src/lib/diagnostics.ts b/web/src/lib/diagnostics.ts index 5e58865..17ae1cb 100644 --- a/web/src/lib/diagnostics.ts +++ b/web/src/lib/diagnostics.ts @@ -31,12 +31,17 @@ export function initDiagnostics(): void { buildNumber: process.env.NEXT_PUBLIC_BUILD_NUMBER ?? '1', releaseChannel: process.env.NEXT_PUBLIC_RELEASE_CHANNEL ?? 'beta', serverUrl: getBaseUrl(), - getAuthToken: () => getAuthClient().getAccessToken() ?? undefined, + getAuthToken: () => { + const token = getAuthClient().getAccessToken(); + if (!token) throw new Error('unauthenticated'); + return token; + }, captureConsole: true, captureErrors: true, captureNetwork: false, pollIntervalMs: 30_000, - }).start(); + }); + void DiagnosticsClient.getInstance().start(); } export function stopDiagnostics(): void {