mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 08:03:39 +00:00
fix(terminal): retain pending DPR recovery
This commit is contained in:
@@ -229,4 +229,26 @@ describe('useTerminalWindowWakeRecovery', () => {
|
||||
window.dispatchEvent(new Event('resize'))
|
||||
expect(repairPaneWebglCanvasDprMismatchMock).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('retains a dpr transition until the visible manager is available', () => {
|
||||
const pane = { id: 1, terminal: {} }
|
||||
const managerRef: { current: PaneManager | null } = { current: null }
|
||||
vi.stubGlobal('devicePixelRatio', 1)
|
||||
renderHook(() =>
|
||||
useTerminalWindowWakeRecovery({
|
||||
isVisible: true,
|
||||
managerRef,
|
||||
isActiveRef: { current: true },
|
||||
isVisibleRef: { current: true }
|
||||
})
|
||||
)
|
||||
|
||||
vi.stubGlobal('devicePixelRatio', 2)
|
||||
window.dispatchEvent(new Event('resize'))
|
||||
expect(repairPaneWebglCanvasDprMismatchMock).not.toHaveBeenCalled()
|
||||
|
||||
managerRef.current = { getPanes: () => [pane] } as unknown as PaneManager
|
||||
window.dispatchEvent(new Event('resize'))
|
||||
expect(repairPaneWebglCanvasDprMismatchMock).toHaveBeenCalledWith(pane)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -122,11 +122,11 @@ export function useTerminalWindowWakeRecovery({
|
||||
if (devicePixelRatio === observedDevicePixelRatio) {
|
||||
return
|
||||
}
|
||||
observedDevicePixelRatio = devicePixelRatio
|
||||
const manager = managerRef.current
|
||||
if (!manager || !isVisibleRef.current) {
|
||||
return
|
||||
}
|
||||
observedDevicePixelRatio = devicePixelRatio
|
||||
for (const pane of manager.getPanes?.() ?? []) {
|
||||
if (repairPaneWebglCanvasDprMismatch(pane)) {
|
||||
presentPaneViewport(pane)
|
||||
|
||||
Reference in New Issue
Block a user