From e4d36c5ebae20c954f61a2756d0b2eb5a720eec6 Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Tue, 17 Feb 2026 16:51:46 +0500 Subject: [PATCH] web: use setting store listener instead of directly using autoUpdates value Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- apps/web/src/hooks/use-auto-updater.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/web/src/hooks/use-auto-updater.ts b/apps/web/src/hooks/use-auto-updater.ts index 1fd226183..870f13d3e 100644 --- a/apps/web/src/hooks/use-auto-updater.ts +++ b/apps/web/src/hooks/use-auto-updater.ts @@ -22,7 +22,7 @@ import { checkForUpdate } from "../utils/updater"; import { AppEventManager, AppEvents } from "../common/app-events"; import BaseStore from "../stores"; import createStore from "../common/store"; -import { store as settingStore } from "../stores/setting-store"; +import { useStore as useSettingStore } from "../stores/setting-store"; type CompletedUpdateStatus = { type: "completed"; version: string }; type DownloadingUpdateStatus = { type: "downloading"; progress: number }; @@ -103,8 +103,13 @@ export function useAutoUpdater() { updateDownloadProgress ); - checkingForUpdate(); - checkForUpdate(settingStore.get().autoUpdates).catch(console.error); + const settingStoreUnsub = useSettingStore.subscribe( + (s) => s.autoUpdates, + (autoUpdates) => { + checkingForUpdate(); + checkForUpdate(autoUpdates).catch(console.error); + } + ); return () => { checkingForUpdateEvent.unsubscribe(); @@ -112,6 +117,7 @@ export function useAutoUpdater() { updateNotAvailableEvent.unsubscribe(); updateCompletedEvent.unsubscribe(); updateProgressEvent.unsubscribe(); + settingStoreUnsub(); }; }, []);