GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(browser): reuse main's aborted-load handling for native Stop · pingdotgg/t3code@5af0254

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/desktop/src/preview
    • Manager.test.ts
    • Manager.ts
  • packages
    • client-runtime/src/preview
      • serverBrowserStream.ts
    • contracts/src
      • preview.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/desktop/src/preview/Manager.test.ts‎

Copy file name to clipboardExpand all lines: apps/desktop/src/preview/Manager.test.ts
-56Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,62 +1025,6 @@ describe("PreviewManager", () => {
10251025
),
10261026
);
10271027

1028-
effectIt.effect.each([
1029-
{ stop: true, code: "ERR_ABORTED", errno: -3, succeeds: true },
1030-
{ stop: false, code: "ERR_ABORTED", errno: -3, succeeds: false },
1031-
{ stop: true, code: "ERR_CONNECTION_REFUSED", errno: -102, succeeds: false },
1032-
])(
1033-
"only an explicit Stop cancels native navigation successfully ($stop, $code)",
1034-
({ stop, code, errno, succeeds }) =>
1035-
withManager((manager) =>
1036-
Effect.gen(function* () {
1037-
const changes = makeChangeSignal();
1038-
const preview = makeFaviconWebContents();
1039-
const started = yield* Deferred.make<void>();
1040-
const navigation = Promise.withResolvers<void>();
1041-
const failure = Object.assign(new Error(code), { code, errno });
1042-
preview.loadURL.mockImplementationOnce(() => {
1043-
Deferred.doneUnsafe(started, Exit.void);
1044-
return navigation.promise;
1045-
});
1046-
preview.setLoading(true);
1047-
Object.assign(preview.webContents, {
1048-
stop: () => {
1049-
preview.setLoading(false);
1050-
preview.listeners.get("did-stop-loading")!();
1051-
navigation.reject(failure);
1052-
},
1053-
});
1054-
fromId.mockReturnValue(preview.webContents);
1055-
const states: PreviewManager.PreviewTabState[] = [];
1056-
yield* manager.subscribeStateChanges((_tabId, state) =>
1057-
Effect.sync(() => {
1058-
states.push(state);
1059-
changes.notify();
1060-
}),
1061-
);
1062-
yield* manager.createTab("tab_stop");
1063-
yield* manager.registerWebview("tab_stop", 42);
1064-
expect(states.at(-1)?.navStatus.kind).toBe("Loading");
1065-
const pending = yield* manager
1066-
.navigate("tab_stop", "https://example.com/pending")
1067-
.pipe(Effect.forkChild);
1068-
yield* Deferred.await(started);
1069-
if (stop) {
1070-
yield* manager.stopLoading("tab_stop");
1071-
yield* changes.until(() => states.at(-1)?.navStatus.kind === "Success");
1072-
} else {
1073-
navigation.reject(failure);
1074-
}
1075-
const result = yield* Fiber.await(pending);
1076-
expect(Exit.isSuccess(result)).toBe(succeeds);
1077-
expect(preview.reload).not.toHaveBeenCalled();
1078-
yield* manager.refresh("tab_stop");
1079-
expect(preview.reload).toHaveBeenCalledOnce();
1080-
}),
1081-
),
1082-
);
1083-
10841028
effectIt.effect("queues navigation until the webview registers", () =>
10851029
withManager((manager) =>
10861030
Effect.gen(function* () {
Collapse file

‎apps/desktop/src/preview/Manager.ts‎

Copy file name to clipboardExpand all lines: apps/desktop/src/preview/Manager.ts
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,8 +2148,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
21482148
if (wc.navigationHistory.canGoForward()) wc.navigationHistory.goForward();
21492149
});
21502150
const refresh = (tabId: string) => withWebContents("refresh", tabId, (wc) => wc.reload());
2151-
const stopLoading = (tabId: string) =>
2152-
withWebContents("stopLoading", tabId, (wc) => wc.stop());
2151+
const stopLoading = (tabId: string) => withWebContents("stopLoading", tabId, (wc) => wc.stop());
21532152
const hardReload = (tabId: string) =>
21542153
withWebContents("hardReload", tabId, (wc) => wc.reloadIgnoringCache());
21552154
const findInPage = (
Collapse file

‎packages/client-runtime/src/preview/serverBrowserStream.ts‎

Copy file name to clipboardExpand all lines: packages/client-runtime/src/preview/serverBrowserStream.ts
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { type DeviceHubAccess, withDeviceHubQuery } from "../device/hubAccess.ts
33
import {
44
PREVIEW_STREAM_HOST_SETUP_CLOSE_CODE,
55
type PreviewStreamHostSetup,
6-
type PreviewStreamNavigationInput,
76
type PreviewViewportSetting,
87
} from "@t3tools/contracts";
98

@@ -88,7 +87,10 @@ export type PreviewStreamInput =
8887
}
8988
| { readonly type: "text"; readonly text: string }
9089
| { readonly type: "resize"; readonly width: number; readonly height: number }
91-
| PreviewStreamNavigationInput
90+
| { readonly type: "navigate"; readonly url: string }
91+
| { readonly type: "history"; readonly delta: -1 | 1 }
92+
| { readonly type: "reload"; readonly ignoreCache?: boolean }
93+
| { readonly type: "stopLoading" }
9294
| { readonly type: "probe"; readonly x: number; readonly y: number };
9395

9496
export interface PreviewStreamDownload {
Collapse file

‎packages/contracts/src/preview.ts‎

Copy file name to clipboardExpand all lines: packages/contracts/src/preview.ts
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ export const PreviewStreamHostSetup = Schema.Struct({
148148
export type PreviewStreamHostSetup = typeof PreviewStreamHostSetup.Type;
149149
export const PREVIEW_STREAM_HOST_SETUP_CLOSE_CODE = 4503;
150150

151-
export type PreviewStreamNavigationInput =
152-
| { readonly type: "navigate"; readonly url: string }
153-
| { readonly type: "history"; readonly delta: -1 | 1 }
154-
| { readonly type: "reload"; readonly ignoreCache?: boolean }
155-
| { readonly type: "stopLoading" };
156-
157151
export const PreviewSessionSnapshot = Schema.Struct({
158152
threadId: TrimmedNonEmptyString,
159153
tabId: PreviewTabId,

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.