diff --git a/.omni/e42f8a19-untitled/memory.md b/.omni/e42f8a19-untitled/memory.md index ef4f66c..1760ebe 100644 --- a/.omni/e42f8a19-untitled/memory.md +++ b/.omni/e42f8a19-untitled/memory.md @@ -18,6 +18,7 @@ ## Key Discoveries - Selection capture is coordinated in `src/background/service-worker.ts`: popup sends `CAPTURE_SCREENSHOT`, service worker injects the selection overlay, then receives `SELECTION_COMPLETE` and crops via the offscreen document. +- Popup runtime message listeners must ignore unrelated messages synchronously; an async listener can interfere with offscreen `ADD_WATERMARK` responses while the popup is open. --- -_Last system refresh: 2026-05-06 06:33 UTC_ +_Last system refresh: 2026-05-06 07:09 UTC_ diff --git a/src/popup/popup.tsx b/src/popup/popup.tsx index 8a7bfab..be5a9f1 100644 --- a/src/popup/popup.tsx +++ b/src/popup/popup.tsx @@ -271,8 +271,12 @@ function PopupApp() { // Listen for upload progress updates useEffect(() => { - const handleMessage = async (message: any) => { - if (message.type === 'UPLOAD_PROGRESS') { + const handleMessage = (message: any) => { + if (message.type !== 'UPLOAD_PROGRESS') { + return false; + } + + void (async () => { const payload = message.payload; // Reload assets to show updated progress @@ -291,7 +295,9 @@ function PopupApp() { metadata: { nid: payload.nid }, } as any); } - } + })(); + + return false; }; chrome.runtime.onMessage.addListener(handleMessage);