mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
fix: fixing memory leak on check-for-updates
This commit is contained in:
parent
34a44e7fa9
commit
0751d6093f
2 changed files with 5 additions and 6 deletions
|
@ -10,24 +10,23 @@ const sendEvent = (event: AppUpdaterEvents) => {
|
||||||
WindowManager.mainWindow?.webContents.send("autoUpdaterEvent", event);
|
WindowManager.mainWindow?.webContents.send("autoUpdaterEvent", event);
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockValuesForDebug = async () => {
|
const mockValuesForDebug = () => {
|
||||||
sendEvent({ type: "update-available", info: { version: "1.3.0" } });
|
sendEvent({ type: "update-available", info: { version: "1.3.0" } });
|
||||||
// sendEvent({ type: "update-downloaded" });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
|
const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
|
||||||
autoUpdater
|
autoUpdater
|
||||||
.addListener("update-available", (info: UpdateInfo) => {
|
.once("update-available", (info: UpdateInfo) => {
|
||||||
sendEvent({ type: "update-available", info });
|
sendEvent({ type: "update-available", info });
|
||||||
})
|
})
|
||||||
.addListener("update-downloaded", () => {
|
.once("update-downloaded", () => {
|
||||||
sendEvent({ type: "update-downloaded" });
|
sendEvent({ type: "update-downloaded" });
|
||||||
});
|
});
|
||||||
|
|
||||||
if (app.isPackaged) {
|
if (app.isPackaged) {
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
} else {
|
} else {
|
||||||
await mockValuesForDebug();
|
mockValuesForDebug();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ export function Header({ onSearch, onClear, search }: HeaderProps) {
|
||||||
return () => {
|
return () => {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
};
|
};
|
||||||
});
|
}, []);
|
||||||
|
|
||||||
const focusInput = () => {
|
const focusInput = () => {
|
||||||
setIsFocused(true);
|
setIsFocused(true);
|
||||||
|
|
Loading…
Reference in a new issue