Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(ui): use tokenExpiresAt for OAuth token expiry display (#1032)
tombii47d188541baf
diff --git a/.gitignore b/.gitignoreindex 1928076dc4..9cb70186d7 100644--- a/.gitignore+++ b/.gitignore@@ -160,4 +160,7 @@ typescript.gemini/# Superpowers plans/specs (internal tooling, not project code)-docs/superpowers/\ No newline at end of file+docs/superpowers/++# GitNexus local index+.gitnexusdiff --git a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx b/src/app/(dashboard)/dashboard/providers/[id]/page.tsxindex 552ed965d7..52198bfa42 100644--- a/src/app/(dashboard)/dashboard/providers/[id]/page.tsx+++ b/src/app/(dashboard)/dashboard/providers/[id]/page.tsx@@ -390,6 +390,7 @@ interface ConnectionRowConnection {globalPriority?: number;providerSpecificData?: Record<string, unknown>;expiresAt?: string;+ tokenExpiresAt?: string;}interface ConnectionRowProps {@@ -4166,22 +4167,25 @@ function ConnectionRow({const [isCooldown, setIsCooldown] = useState(false);// T12: token expiry status — lazy init avoids calling Date.now() during render;// updates every 30s via interval only (no sync setState in effect body).+ // Prefer tokenExpiresAt (updated on each refresh) over expiresAt (original grant date).+ const effectiveExpiresAt = connection.tokenExpiresAt || connection.expiresAt;const getTokenMinsLeft = () => {- if (!isOAuth || !connection.expiresAt) return null;- const expiresMs = new Date(connection.expiresAt).getTime();+ if (!isOAuth || !effectiveExpiresAt) return null;+ const expiresMs = new Date(effectiveExpiresAt).getTime();return Math.floor((expiresMs - Date.now()) / 60000);};const [tokenMinsLeft, setTokenMinsLeft] = useState<number | null>(getTokenMinsLeft);useEffect(() => {- if (!isOAuth || !connection.expiresAt) return;+ if (!isOAuth || !effectiveExpiresAt) return;const update = () => {- const expiresMs = new Date(connection.expiresAt).getTime();+ const expiresMs = new Date(effectiveExpiresAt).getTime();setTokenMinsLeft(Math.floor((expiresMs - Date.now()) / 60000));};+ update();const iv = setInterval(update, 30000);return () => clearInterval(iv);- }, [isOAuth, connection.expiresAt]);+ }, [isOAuth, effectiveExpiresAt]);useEffect(() => {const checkCooldown = () => {@@ -4253,7 +4257,7 @@ function ConnectionRow({(tokenMinsLeft < 0 ? (<spanclassName="inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-xs font-medium bg-red-500/15 text-red-500"- title={`Token expired: ${connection.expiresAt}`}+ title={`Token expired: ${effectiveExpiresAt}`}><span className="material-symbols-outlined text-[11px]">error</span>expired