MyMailProtocol / permamail-app

Mail inbox app deployed on the permaweb
Apache License 2.0
7 stars 2 forks source link

Initiate background refresh on browser tab activation #3

Open DanMacDonald opened 2 years ago

DanMacDonald commented 2 years ago

Currently the inbox performs a background refresh when returning to it from viewing a thread or composing a new message. It would be better if the app could detect when the browser tab became active and performed a background InboxThread refresh on the users behalf.

Yakumwamba commented 2 years ago

Hi @DanMacDonald , could you give more details to replicate the issue. thanks

DanMacDonald commented 2 years ago

This issue is more about whats missing rather than what is present...

  1. With walletA sign into the Inbox
  2. Background the Inbox by brining another browser tab to the foreground.
  3. With walletB sign into the Inbox and send walletA a message
  4. Foreground the walletA inbox tab by clicking on it in the browser.

Observed behavior: WalletB's message to WalletA does not appear in WalletA's inbox.

Expected Behavior: After a few seconds WalletB's message should appear in WalletA's inbox as unread.

Notes: If you view a message thread by clicking on it in WalletA's inbox, and then click the "Inbox" button in top left to return to the inbox view, the app will perform a background refresh of the inbox calling getWeavemailItems() to check Arweave for updated message transactions.

The solution to this issue is to listen to a "tab activated" event from the browser and initiate the background refresh call.