fix(terminal): improve tab visibility checks and positioning
All checks were successful
Beta Release / beta (push) Successful in 48s
All checks were successful
Beta Release / beta (push) Successful in 48s
- Add null check for container before accessing offsetHeight - Validate activeTabRef during initialization and fit operations - Check for display:none as visibility indicator - Simplify useEffect dependency array - Use absolute positioning for terminal wrapper/instance 💘 Generated with Crush Assisted-by: MiniMax-M2.7 via Crush <crush@charm.land>
This commit is contained in:
@@ -443,7 +443,12 @@ export default function Shell({ api }) {
|
||||
return
|
||||
}
|
||||
const container = document.getElementById(`terminal-${tab.id}`)
|
||||
if (!container || container.offsetHeight === 0) {
|
||||
if (!container) {
|
||||
pending.push(setTimeout(() => tryInit(attempt + 1), 100))
|
||||
return
|
||||
}
|
||||
if (activeTabRef.current !== tab.id) return
|
||||
if (container.offsetHeight === 0 || container.style.display === 'none') {
|
||||
pending.push(setTimeout(() => tryInit(attempt + 1), 100))
|
||||
return
|
||||
}
|
||||
@@ -452,6 +457,7 @@ export default function Shell({ api }) {
|
||||
}
|
||||
requestAnimationFrame(() => {
|
||||
if (cancelled) return
|
||||
if (activeTabRef.current !== tab.id) return
|
||||
const entry = tabsRef.current[tab.id]
|
||||
if (entry) entry.fitAddon.fit()
|
||||
})
|
||||
@@ -462,7 +468,7 @@ export default function Shell({ api }) {
|
||||
cancelled = true
|
||||
pending.forEach(clearTimeout)
|
||||
}
|
||||
}, [activeTab, tabs, initTerminal])
|
||||
}, [activeTab, initTerminal])
|
||||
|
||||
useEffect(() => {
|
||||
const iv = setInterval(() => {
|
||||
|
||||
Reference in New Issue
Block a user