Browse Source

fix: emit watchIdChange correctly

Sven 9 months ago
parent
commit
323ba564fb
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/siteEvents.ts

+ 1 - 1
src/siteEvents.ts

@@ -232,9 +232,9 @@ export function emitSiteEvent<TKey extends keyof SiteEventsMap>(key: TKey, ...ar
 function checkWatchIdChange(newId?: string | null) {
   const newWatchId = newId ?? new URL(location.href).searchParams.get("v");
   if(newWatchId && newWatchId !== lastWatchId) {
-    lastWatchId = newWatchId;
     info(`Detected watch ID change - old ID: "${lastWatchId}" - new ID: "${newWatchId}"`);
     emitSiteEvent("watchIdChanged", newWatchId, lastWatchId);
+    lastWatchId = newWatchId;
   }
 }