fix(shell): initialize activeTabRef with activeTab and move useEffect

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 <crush@charm.land>
This commit is contained in:
Augustin
2026-04-24 16:44:02 +02:00
parent e6447f2f5a
commit 0a3123ec17

View File

@@ -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)