From 0a3123ec1762b9967bae35fa623521853fdba739 Mon Sep 17 00:00:00 2001 From: Augustin Date: Fri, 24 Apr 2026 16:44:02 +0200 Subject: [PATCH] fix(shell): initialize activeTabRef with activeTab and move useEffect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reorder code to follow React hooks rules - initialize ref with value instead of null, then update via useEffect. 💘 Generated with Crush Assisted-by: MiniMax-M2.7 via Crush --- web/src/components/Shell.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/web/src/components/Shell.jsx b/web/src/components/Shell.jsx index 70b2df8..633c7a8 100644 --- a/web/src/components/Shell.jsx +++ b/web/src/components/Shell.jsx @@ -204,11 +204,8 @@ export default function Shell({ api }) { const tabsRef = useRef({}) const nextIdRef = useRef(1) const settingsRef = useRef({ fontSize: 12, fontFamily: "'JetBrains Mono', 'Fira Code', monospace", theme: 'default' }) - const activeTabRef = useRef(null) const pendingCommandsRef = useRef({}) - useEffect(() => { activeTabRef.current = activeTab }, [activeTab]) - const savedTabs = (() => { try { const raw = localStorage.getItem(TABS_STORAGE_KEY) @@ -231,6 +228,8 @@ export default function Shell({ api }) { } return 1 }) + const activeTabRef = useRef(activeTab) + useEffect(() => { activeTabRef.current = activeTab }, [activeTab]) const [sshConnections, setSshConnections] = useState([]) const [systemTerminals, setSystemTerminals] = useState([]) const [showMenu, setShowMenu] = useState(false)