We were not sending IS_FRAME_MONETIZED due to a premature optimization (not sending it when no tags), so we weren't updating the state when required.
Also had some timing issues with not await-ing.
We now use sender.tab.id to ensure we set the icon for the right tab, and not override it from a stale message from a different tab (race condition).
As discussed in call today, in future we'll try to make use of a TabStateService and use that as source of truth, and reduce reliance on message passing.
Context
Closes https://github.com/interledger/web-monetization-extension/issues/329.
Changes proposed in this pull request
IS_FRAME_MONETIZED
due to a premature optimization (not sending it when no tags), so we weren't updating the state when required.await
-ing.sender.tab.id
to ensure we set the icon for the right tab, and not override it from a stale message from a different tab (race condition).As discussed in call today, in future we'll try to make use of a
TabStateService
and use that as source of truth, and reduce reliance on message passing.