fix: hide stale terminal portal after restore churn
This commit is contained in:
parent
e41f39bd75
commit
836360db36
1 changed files with 24 additions and 9 deletions
|
|
@ -1211,18 +1211,33 @@ final class WindowTerminalPortal: NSObject {
|
|||
return
|
||||
}
|
||||
guard let anchorView = entry.anchorView, let window else {
|
||||
// Only hide if the entry is not marked visibleInUI. When a workspace is
|
||||
// remounting, updateNSView sets visibleInUI=true before the deferred bind
|
||||
// provides an anchor — hiding here would race with that and cause a flash.
|
||||
if !entry.visibleInUI {
|
||||
if entry.visibleInUI {
|
||||
let shouldPreserveVisibleOnTransient = !hostedView.isHidden &&
|
||||
scheduleTransientRecoveryRetryIfNeeded(
|
||||
forHostedId: hostedId,
|
||||
entry: &entry,
|
||||
hostedView: hostedView,
|
||||
reason: "missingAnchorOrWindow"
|
||||
)
|
||||
if shouldPreserveVisibleOnTransient {
|
||||
#if DEBUG
|
||||
if !hostedView.isHidden {
|
||||
dlog("portal.hidden hosted=\(portalDebugToken(hostedView)) value=1 reason=missingAnchorOrWindow")
|
||||
}
|
||||
dlog(
|
||||
"portal.hidden.deferKeep hosted=\(portalDebugToken(hostedView)) " +
|
||||
"reason=missingAnchorOrWindow frame=\(portalDebugFrame(hostedView.frame))"
|
||||
)
|
||||
#endif
|
||||
hostedView.isHidden = true
|
||||
resetTransientRecoveryRetryIfNeeded(forHostedId: hostedId, entry: &entry)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
resetTransientRecoveryRetryIfNeeded(forHostedId: hostedId, entry: &entry)
|
||||
}
|
||||
#if DEBUG
|
||||
if !hostedView.isHidden {
|
||||
dlog("portal.hidden hosted=\(portalDebugToken(hostedView)) value=1 reason=missingAnchorOrWindow")
|
||||
}
|
||||
#endif
|
||||
hostedView.isHidden = true
|
||||
if entry.visibleInUI {
|
||||
_ = scheduleTransientRecoveryRetryIfNeeded(
|
||||
forHostedId: hostedId,
|
||||
entry: &entry,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue