fix: stabilize selection capture target tab#82
Conversation
|
Code review note: PR 82 stabilizes the tab used for injecting the selection overlay, but |
|
Updated in commit e8c41fb. Selection completion now reuses the pending target tab captured when the overlay is injected, clears that target on success/cancel/timeout/error, and no longer re-resolves the active tab with currentWindow before captureVisibleTab. |
e8c41fb to
034a47c
Compare
|
Follow-up: amended the fix into commit 034a47c to also clear pending selection state if overlay injection fails before the pending promise is created. |
numbers-official
left a comment
There was a problem hiding this comment.
One remaining edge case: if a previous selection is still pending and the user starts a new popup-initiated selection, sets before calling , but may immediately call , which resets back to . The new selection then continues with the wrong popup/non-popup state, so it can incorrectly show the auto-upload/notification behavior for a popup flow.\n\nA small fix would be to pass into and assign only after rejecting any existing pending selection, together with .
|
Correction for the review note above: one remaining edge case is when a previous selection is still pending and the user starts a new popup-initiated selection.
A small fix would be to pass |
|
Updated in commit |
|
Re-reviewed commit I also checked the popup capture flow against AssetEditModal and auto-upload-after-capture:
Local |
Summary
currentWindowWhy
Selection mode could fail with
Failed to start selection mode. Make sure you are on a valid web page.because the service worker re-resolved the active tab after focus moved to the extension popup. The popup now sends the intended target tab explicitly, and the background keeps that same target through the selection completion flow.This also avoids a follow-up regression where replacing an existing pending selection could reset the new capture's
fromPopupstate.Asset edit modal and auto-upload behavior
fromPopup: trueRegister to Numberssaves metadata first, then queues upload viaUPLOAD_ASSETsettings.autoUpload && !fromPopup, so auto-upload after capture remains intactVerification
npm run lint(0 errors; existing warnings only)npx tsc --noEmitnpm run build