Skip to content

Commit c482cbd

Browse files
committed
fix(desktop): read current navigation event details
1 parent c45a5dc commit c482cbd

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,11 +3191,21 @@ describe("PreviewManager", () => {
31913191
const pick = yield* manager.pickElement("tab_1").pipe(Effect.forkChild);
31923192
yield* Effect.yieldNow;
31933193

3194-
listeners.get("did-start-navigation")?.({}, "about:blank", false, false);
3194+
listeners.get("did-start-navigation")?.({
3195+
url: "about:blank",
3196+
isSameDocument: false,
3197+
isMainFrame: false,
3198+
frame: null,
3199+
});
31953200
yield* Effect.yieldNow;
31963201
expect(pick.pollUnsafe()).toBeUndefined();
31973202

3198-
listeners.get("did-start-navigation")?.({}, "https://example.com/next", false, true);
3203+
listeners.get("did-start-navigation")?.({
3204+
url: "https://example.com/next",
3205+
isSameDocument: false,
3206+
isMainFrame: true,
3207+
frame: null,
3208+
});
31993209
yield* Effect.yieldNow;
32003210
expect(pick.pollUnsafe()).toBeDefined();
32013211
expect(yield* Fiber.join(pick)).toBeNull();

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,12 +2503,9 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
25032503
};
25042504
const onDestroyed = () => settle(null);
25052505
const onNavigated = (
2506-
_event: Electron.Event,
2507-
_url: string,
2508-
_isInPlace: boolean,
2509-
isMainFrame: boolean,
2506+
event: Electron.Event<Electron.WebContentsDidStartNavigationEventParams>,
25102507
) => {
2511-
if (isMainFrame) settle(null);
2508+
if (event.isMainFrame) settle(null);
25122509
};
25132510
const registerPickElement = Effect.fn("PreviewManager.registerPickElement")(function* () {
25142511
// Two picks on one tab can overlap. Swap this session in and cancel

0 commit comments

Comments
 (0)