mirror of
https://github.com/stablyai/orca.git
synced 2026-10-09 08:02:35 +00:00
fix(renderer): clear close debounce timers on unmount
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { CLOSE_DIALOG_DEBOUNCE_MS } from './terminal-workspace-model'
|
||||
import {
|
||||
assessWindowCloseRunningWork,
|
||||
@@ -27,6 +27,15 @@ export function useTerminalEditorCloseFoundation(
|
||||
}, CLOSE_DIALOG_DEBOUNCE_MS)
|
||||
closeDialogDebounceTimersRef.current.add(timer)
|
||||
}, [])
|
||||
useEffect(() => {
|
||||
const debounceTimers = closeDialogDebounceTimersRef.current
|
||||
return () => {
|
||||
for (const timer of debounceTimers) {
|
||||
window.clearTimeout(timer)
|
||||
}
|
||||
debounceTimers.clear()
|
||||
}
|
||||
}, [])
|
||||
const [windowCloseDialogOpen, setWindowCloseDialogOpen] = useState(false)
|
||||
// Why: "running" and "could not reach the host" are different claims, and telling the user
|
||||
// processes are running when the truth is that a host went quiet is the fabricated certainty
|
||||
|
||||
Reference in New Issue
Block a user