fix(shell): resolve savedTabs undefined ReferenceError in activeTab init
💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
@@ -271,9 +271,13 @@ export default function Shell({ api }) {
|
||||
]
|
||||
})
|
||||
const [activeTab, setActiveTab] = useState(() => {
|
||||
if (savedTabs) {
|
||||
return savedTabs[0]?.id || 1
|
||||
}
|
||||
try {
|
||||
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
|
||||
})
|
||||
const activeTabRef = useRef(activeTab)
|
||||
|
||||
Reference in New Issue
Block a user