mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 08:03:33 +00:00
fix(terminal): clear stale parked frame on empty snapshot
This commit is contained in:
@@ -889,6 +889,25 @@ describe('createRemoteRuntimePtyTransport', () => {
|
||||
transport.destroy?.()
|
||||
})
|
||||
|
||||
it('forwards an empty authoritative snapshot so a cached parked viewport clears', async () => {
|
||||
const { createRemoteRuntimePtyTransport } = await import('./remote-runtime-pty-transport')
|
||||
const onReplayData = vi.fn()
|
||||
const transport = createRemoteRuntimePtyTransport('env-1', {
|
||||
worktreeId: 'wt-1',
|
||||
tabId: 'web-terminal-host-tab-1',
|
||||
leafId: 'pane:1'
|
||||
})
|
||||
|
||||
const connect = transport.connect({ url: '', callbacks: { onReplayData } })
|
||||
await vi.waitFor(() => expect(subscriptionSendBinary).toHaveBeenCalled())
|
||||
emitSnapshot(latestSubscribePayload().streamId, '')
|
||||
await connect
|
||||
|
||||
expect(onReplayData).toHaveBeenCalledOnce()
|
||||
expect(onReplayData).toHaveBeenCalledWith('')
|
||||
transport.destroy?.()
|
||||
})
|
||||
|
||||
it('keeps the current mirror input queue when an older connect settles', async () => {
|
||||
const healthyRuntimeCall = runtimeCall.getMockImplementation()
|
||||
let releaseFirstActivation = (): void => {}
|
||||
|
||||
@@ -1858,8 +1858,8 @@ export function createRemoteRuntimePtyTransport(
|
||||
}
|
||||
},
|
||||
onSnapshot: (data, meta) => {
|
||||
// Why: an empty snapshot can still carry a pending mid-escape tail that must replay so the next live chunk completes it.
|
||||
if ((data || meta?.pendingEscapeTailAnsi) && isCurrentSubscription()) {
|
||||
// Why: an empty snapshot is still authoritative and must clear a cached parked viewport.
|
||||
if (isCurrentSubscription()) {
|
||||
if (subscribedPtyId && bufferPtyShutdownReplayData(subscribedPtyId, data)) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user