Skip to content

Commit acf5693

Browse files
committed
fix: use loadURL(applicationUrl) instead of reload() for dev retry
When the initial dev load fails, webContents.reload() may reload the error page or about:blank rather than the intended application URL. Replace the reload() call with loadApplication() which uses loadURL(applicationUrl), matching the initial navigation and ensuring retries target the correct URL.
1 parent af87374 commit acf5693

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

apps/desktop/src/window/DesktopWindow.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,13 @@ describe("DesktopWindow", () => {
266266
assert.equal(fakeWindow.loadURL.mock.calls.length, 1);
267267

268268
yield* TestClock.adjust(100);
269-
assert.deepEqual(fakeWindow.loadURL.mock.calls, [["t3code-dev://app/"]]);
270-
assert.equal(fakeWindow.reload.mock.calls.length, 1);
269+
assert.equal(fakeWindow.loadURL.mock.calls.length, 2);
270+
assert.deepEqual(fakeWindow.loadURL.mock.calls[1], ["t3code-dev://app/"]);
271271

272272
didFailLoad({}, -9, "ERR_UNEXPECTED", "t3code-dev://app/", true);
273273
didFinishLoad();
274274
yield* TestClock.adjust(250);
275-
assert.equal(fakeWindow.loadURL.mock.calls.length, 1);
276-
assert.equal(fakeWindow.reload.mock.calls.length, 1);
275+
assert.equal(fakeWindow.loadURL.mock.calls.length, 2);
277276
}).pipe(Effect.provide(layer));
278277
}),
279278
);

apps/desktop/src/window/DesktopWindow.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,7 @@ export const make = Effect.gen(function* () {
338338
Effect.andThen(
339339
Effect.sync(() => {
340340
developmentLoadRetryFiber = undefined;
341-
if (!window.isDestroyed()) {
342-
window.webContents.reload();
343-
}
341+
loadApplication();
344342
}),
345343
),
346344
),

0 commit comments

Comments
 (0)