Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): reduce app crashes when a preview tab's renderer dies during agent screenshots #24056

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/24056/headmerged by shivamhwp(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 106 additions and 3 deletions (loading 1).

x
0 of 2 viewed, 2 left
106 additions and 3 deletionsapps/desktop/src/preview/DesktopBrowserHost.test.tsModified
View file
@@ -3,6 +3,7 @@
import { DesktopBrowserEvent } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
+import * as Queue from "effect/Queue";
import * as Schema from "effect/Schema";
import * as Stream from "effect/Stream";
import * as NodeEvents from "node:events";
@@ -15,32 +16,54 @@
Schema.fromJsonString(Schema.Struct({ id: Schema.Number })),
);
const key = { threadId: "thread-1", tabId: "tab-1" };
+/** Sends a page command whose id the fake debugger records as it receives it. */
+const command = (
+ host: DesktopBrowserHost.DesktopBrowserHost["Service"],
+ id: number,
+ method: string,
+) =>
+ host.handleCommandLine(
+ encodeJson({
+ type: "cdp",
+ ...key,
+ message: encodeJson({ id, method, params: { id }, sessionId: "t3-preview-page" }),
+ }),
+ );
​
const makeDebuggee = () => {
const emitter = new NodeEvents.EventEmitter();
const pending: Array<() => void> = [];