Skip to content

Commit f4e1c70

Browse files
committed
fix: reset recovery counter only after confirmed successful reload
1 parent 224b58c commit f4e1c70

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/ui/main/rootWindow.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,13 +559,20 @@ export const showRootWindow = async (): Promise<void> => {
559559
await session.clearStorageData({
560560
storages: ['shadercache', 'cachestorage'],
561561
});
562+
563+
if (recoveryResetTimer) {
564+
clearTimeout(recoveryResetTimer);
565+
recoveryResetTimer = null;
566+
}
567+
568+
browserWindow.webContents.once('did-finish-load', () => {
569+
recoveryResetTimer = setTimeout(() => {
570+
rendererRecoveryAttempts = 0;
571+
}, RECOVERY_RESET_DELAY_MS);
572+
});
573+
562574
console.log('Cache cleared. Reloading window...');
563575
browserWindow.reload();
564-
565-
if (recoveryResetTimer) clearTimeout(recoveryResetTimer);
566-
recoveryResetTimer = setTimeout(() => {
567-
rendererRecoveryAttempts = 0;
568-
}, RECOVERY_RESET_DELAY_MS);
569576
} catch (error) {
570577
console.error('Failed to recover from crash:', error);
571578
app.quit();

0 commit comments

Comments
 (0)