fix(shell): resolve savedTabs undefined ReferenceError in activeTab init
All checks were successful
Beta Release / beta (push) Successful in 50s
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:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user