Browse Source

fix(auto-update-checker): skip update check for pinned versions (#232)

Hakim Zulkufli 4 months ago
parent
commit
5ac9abe5c8
1 changed files with 5 additions and 22 deletions
  1. 5 22
      src/hooks/auto-update-checker/index.ts

+ 5 - 22
src/hooks/auto-update-checker/index.ts

@@ -95,6 +95,11 @@ async function runBackgroundUpdateCheck(
     return;
   }
 
+  if (pluginInfo.isPinned) {
+    log(`[auto-update-checker] Version is pinned; skipping update check.`);
+    return;
+  }
+
   const channel = extractChannel(pluginInfo.pinnedVersion ?? currentVersion);
   const latestVersion = await getLatestVersion(channel);
   if (!latestVersion) {
@@ -129,28 +134,6 @@ async function runBackgroundUpdateCheck(
     return;
   }
 
-  if (pluginInfo.isPinned) {
-    const updated = updatePinnedVersion(
-      pluginInfo.configPath,
-      pluginInfo.entry,
-      latestVersion,
-    );
-    if (!updated) {
-      showToast(
-        ctx,
-        `OMO-Slim ${latestVersion}`,
-        `v${latestVersion} available. Restart to apply.`,
-        'info',
-        8000,
-      );
-      log('[auto-update-checker] Failed to update pinned version in config');
-      return;
-    }
-    log(
-      `[auto-update-checker] Config updated: ${pluginInfo.entry} → ${PACKAGE_NAME}@${latestVersion}`,
-    );
-  }
-
   invalidatePackage(PACKAGE_NAME);
 
   const installSuccess = await runBunInstallSafe(ctx);