Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): reclaim hidden tabs after automation timeouts #14084

Closedvoltcrash(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/14084/headopened View on GitHub

Showing 4 changed files with 200 additions and 0 deletions (loading 3).

x
0 of 4 viewed, 4 left
200 additions and 0 deletionsapps/web/src/components/preview/PreviewAutomationHosts.test.tsxModified
View file
@@ -36,6 +36,7 @@
),
list: vi.fn(async () => AsyncResult.success(emptyList)),
resize: vi.fn(),
+ close: vi.fn(async () => AsyncResult.success(undefined)),
respond:
vi.fn<
(target: { environmentId: EnvironmentId; input: PreviewAutomationResponse }) => Promise<void>
@@ -56,6 +57,7 @@
list: () => listAtom,
open: mocks.open,
resize: mocks.resize,
+ close: mocks.close,
respondToAutomation: mocks.respond,
focusAutomationHost: mocks.focus,
},
@@ -211,6 +213,158 @@
});
});
​
+describe("PreviewAutomationHosts timeout cleanup", () => {
+ it("closes a hidden tab created after its open request already timed out", async () => {
+ const opened = deferred<Awaited<ReturnType<typeof mocks.open>>>();
+ mocks.open.mockImplementationOnce(() => opened.promise);
+ vi.useFakeTimers();
+ try {
+ await act(async () => {
+ appAtomRegistry.set(