From 36d39e4a47e866e9be53f9151c0a34dd67ce4f25 Mon Sep 17 00:00:00 2001 From: TaskPool Date: Sat, 8 Aug 2026 03:37:15 +0800 Subject: [PATCH] fix(NodeSwitcher): return null during SSR to avoid hydration mismatch --- web/src/components/business/NodeSwitcher.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/src/components/business/NodeSwitcher.tsx b/web/src/components/business/NodeSwitcher.tsx index 781993d..6a820eb 100644 --- a/web/src/components/business/NodeSwitcher.tsx +++ b/web/src/components/business/NodeSwitcher.tsx @@ -26,6 +26,9 @@ export function NodeSwitcher() { setSelected(activeInterconnectNodeId || 'local') }, []) + // SSR 时返回 null,避免 hydration 错误 + if (!mounted) return null + const fetchNodes = useCallback(async () => { try { const res = await getNodes()