Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Only a real `powerMonitor` resume event requests recovery; ordinary focus change

Each resume gets a new epoch. Suspend, a replacing main-frame navigation, or window close cancels pending recovery and its retry timer. A response from an older epoch cannot reload the current page. A newer resume arriving during an older check waits until that check settles before starting another check. Window close also removes this packet's power and navigation listeners.

Once connectivity is reported, the callback consumes its one pending recovery. It reloads only while the application is not quitting, the window and web contents are live, and a main-frame load is not already in progress. Reload itself keeps the existing PR's semantics. The connectivity library retains its own per-call behavior; this change does not cancel an already running network check. A check that never settles stalls later checks rather than permitting parallel checks.
Once connectivity is reported, the callback consumes its one pending recovery. It reloads only while the application is not quitting, the window and web contents are live, and a main-frame load is not already in progress. Reload itself keeps the existing PR's semantics. The connectivity library retains its own per-call behavior; this change does not cancel an already running network check. A check that never settles stalls later checks rather than permitting parallel checks. An exception outside the connectivity promise, including a failed Electron reload, cancels that recovery attempt through an outer catch. It does not escape as a rejected unawaited callback, and it does not start a reload retry loop; the existing manual reload remains available.

The navigation listener uses Electron 29's documented deprecated positional `did-start-navigation` arguments. The exact [v29.0.1 API source](https://github.com/electron/electron/blob/v29.0.1/docs/api/web-contents.md) documents those arguments and `isLoadingMainFrame()`, `isDestroyed()` and `reload()`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ diff --git a/source/index.ts b/source/index.ts
import updateAppMenu from './menu';
import config, {StoreType} from './config';
import tray from './tray';
@@ -431,14 +432,88 @@
@@ -431,14 +432,91 @@

const {webContents} = mainWindow;

Expand Down Expand Up @@ -67,6 +67,9 @@ diff --git a/source/index.ts b/source/index.ts
+ webContents.reload();
+ }
+ }
+ } catch {
+ // A failed Electron operation ends this attempt; manual reload remains available.
+ cancelResumeRecovery();
+ } finally {
+ connectivityCheckRunning = false;
+ if (resumePending && canRecoverResume() && resumeRetry === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ function createMainWindow(): BrowserWindow {
webContents.reload();
}
}
} catch {
// A failed Electron operation ends this attempt; manual reload remains available.
cancelResumeRecovery();
} finally {
connectivityCheckRunning = false;
if (resumePending && canRecoverResume() && resumeRetry === undefined) {
Expand Down
Loading