Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): server browser tabs nobody watches stop rendering #21902

Closedspencermorris04(GitHub profile, opens in a new tab)wants to merge 7 commits intomain fromrefs/pull/21902/headopened View on GitHub

Showing 7 changed files with 194 additions and 1 deletion (loading 5).

x
0 of 7 viewed, 7 left
194 additions and 1 deletionapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -39,7 +39,9 @@
import * as ServerBrowser from "./ServerBrowser.ts";
import * as PreviewBrowser from "./PreviewBrowser.ts";
​
-vi.mock("./ServerBrowserContexts.ts", () => ({
+vi.mock("./ServerBrowserContexts.ts", async (importOriginal) => ({
+ setPageHidden: (await importOriginal<typeof import("./ServerBrowserContexts.ts")>())
+ .setPageHidden,
presentAsChrome: async () => {},
ServerBrowserContexts: class {
private readonly onClose: ((context: BrowserContext) => void) | undefined;
@@ -58,6 +60,7 @@
return makeEncoderPage() as unknown as Page;
async connectDesktopPage(endpoint: string) {
+ desktopConnected.resolve();
const context = makeContext(undefined, desktopPageUrl);
context.page.viewportSize.mockReturnValue(null);
desktopConnections.push({ endpoint, context });
@@ -315,6 +318,7 @@
const releasedDesktopTabs: Array<string> = [];
const desktopTurns = new NodeEvents.EventEmitter();
+let desktopConnected = Promise.withResolvers<void>();
const desktopConnections: Array<{ endpoint: string; context: ReturnType<typeof makeContext> }> = [];
const testThread = {
threadId: ThreadId.make("browser-test-thread"),