Skip to content

Commit 703ac77

Browse files
committed
fix stale destroy bug
1 parent 8ca1f71 commit 703ac77

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

emain/emain-tabview.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ export class WaveTabView extends WebContentsView {
157157
this.waveReadyPromise.then(() => {
158158
this.isWaveReady = true;
159159
});
160-
wcIdToWaveTabMap.set(this.webContents.id, this);
160+
const wcId = this.webContents.id;
161+
wcIdToWaveTabMap.set(wcId, this);
161162
if (isDevVite) {
162163
this.webContents.loadURL(`${process.env.ELECTRON_RENDERER_URL}/index.html`);
163164
} else {
164165
this.webContents.loadFile(path.join(getElectronAppBasePath(), "frontend", "index.html"));
165166
}
166167
this.webContents.on("destroyed", () => {
167-
wcIdToWaveTabMap.delete(this.webContents.id);
168+
wcIdToWaveTabMap.delete(wcId);
168169
removeWaveTabView(this.waveTabId);
169170
this.isDestroyed = true;
170171
});
@@ -286,7 +287,6 @@ function checkAndEvictCache(): void {
286287
// Otherwise, sort by lastUsedTs
287288
return a.lastUsedTs - b.lastUsedTs;
288289
});
289-
const now = Date.now();
290290
for (let i = 0; i < sorted.length - MaxCacheSize; i++) {
291291
tryEvictEntry(sorted[i].waveTabId);
292292
}

0 commit comments

Comments
 (0)