mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 00:03:20 +00:00
Prevent duplicate terminal wake recovery on overlapping window events
When window focus and visibility events fire concurrently, they can trigger multiple redundant wake recovery passes. - Return early if a wake recovery frame is already scheduled. - Keep the scheduled animation frame instead of canceling it to ensure we get a settled recovery pass.
This commit is contained in:
@@ -29,6 +29,10 @@ export function useTerminalWindowWakeRecovery({
|
||||
wakeRecoveryFrameId = null
|
||||
}
|
||||
const recoverVisibleWake = (): void => {
|
||||
// Focus and visibility often fire together; keep one immediate recovery and one settled RAF pass.
|
||||
if (wakeRecoveryFrameId !== null) {
|
||||
return
|
||||
}
|
||||
const manager = managerRef.current
|
||||
if (!manager) {
|
||||
return
|
||||
@@ -37,7 +41,6 @@ export function useTerminalWindowWakeRecovery({
|
||||
manager,
|
||||
isActive: isActiveRef.current
|
||||
})
|
||||
cancelScheduledWakeRecovery()
|
||||
if (typeof requestAnimationFrame !== 'function') {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user