fix(shell): resolve savedTabs undefined ReferenceError in activeTab init
All checks were successful
Beta Release / beta (push) Successful in 50s

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-24 21:36:25 +02:00
parent 5627ddd2ce
commit b8aa935bec

View File

@@ -271,9 +271,13 @@ export default function Shell({ api }) {
] ]
}) })
const [activeTab, setActiveTab] = useState(() => { const [activeTab, setActiveTab] = useState(() => {
if (savedTabs) { try {
return savedTabs[0]?.id || 1 const raw = localStorage.getItem(TABS_STORAGE_KEY)
} if (raw) {
const parsed = JSON.parse(raw)
if (Array.isArray(parsed) && parsed.length > 0) return parsed[0]?.id || 1
}
} catch {}
return 1 return 1
}) })
const activeTabRef = useRef(activeTab) const activeTabRef = useRef(activeTab)