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(offline): avoid SSR/CSR hydration mismatch on navigator.onLine
diegosouzapwef800eee40c9
diff --git a/src/app/offline/page.tsx b/src/app/offline/page.tsxindex 045b254fc7..a280f45814 100644--- a/src/app/offline/page.tsx+++ b/src/app/offline/page.tsx@@ -1,25 +1,24 @@"use client";-import { useEffect, useState } from "react";+import { useSyncExternalStore } from "react";import Link from "next/link";+function subscribeToOnline(callback: () => void) {+ window.addEventListener("online", callback);+ window.addEventListener("offline", callback);+ return () => {+ window.removeEventListener("online", callback);+ window.removeEventListener("offline", callback);+ };+}+export default function OfflinePage() {- const [isOnline, setIsOnline] = useState<boolean>(() =>- typeof navigator !== "undefined" ? navigator.onLine : true+ const isOnline = useSyncExternalStore(+ subscribeToOnline,+ () => navigator.onLine,+ () => false);- useEffect(() => {- const onOnline = () => setIsOnline(true);- const onOffline = () => setIsOnline(false);-- window.addEventListener("online", onOnline);- window.addEventListener("offline", onOffline);- return () => {- window.removeEventListener("online", onOnline);- window.removeEventListener("offline", onOffline);- };- }, []);-return (<main className="min-h-screen bg-bg text-text-main flex items-center justify-center p-6"><section className="w-full max-w-xl rounded-2xl border border-border bg-surface p-8 shadow-soft text-center">