Add a communication channel for forcing reloads across tab sessions.
Review Request #13048 — Created May 16, 2023 and submitted
The new behavior for the unified banner means that individual tabs fetch
and keep track of pending review/draft IDs more eagerly than before. The
result of this is that it was easier to hit bugs when performing actions
with a review request open in multiple tabs.This change adds a small utility that makes use of the
BroadcastChannel
API to coordinate across multiple tabs/windows within
a browser session. Right now the only message that we send is "reload",
which asks other tabs to reload their contents. This is sent when
something is either published or discarded, which invalidates draft IDs.The broadcast channel is origin-wide, so each
PageView
can implement a
method to return a data blob that's used for filtering whether or not to
reload. The default implementation is empty, andReviewablePageView
will filter based on the review request ID (so any open tabs related to
that review request will be triggered).
- Ran js-tests.
- Published review requests, reviews, and replies from one tab, and saw
other tabs pop up the alert and reload. - Discarded drafts from the unified banner and from the review dialog,
and saw other tabs pop up the alert and reload.
Summary | ID |
---|---|
1bbc4c4e7e9ba3cdd2e68c13c93a619834cb6771 |
Description | From | Last Updated |
---|---|---|
We're going to need tests for this, which will be especially important for any filtering logic and any future use … |
chipx86 | |
I also want to discuss naming. Eventually, we'll want an open comm channel to the Review Board server as well. … |
chipx86 | |
Can you add a Version Added? |
chipx86 | |
This is missing docs. Should also have Version Added, which I've unfortunately left out of my other TS reviews. |
chipx86 | |
Missing Version Added. |
chipx86 | |
Should document this. |
maubin | |
Should document this. |
maubin | |
I think you could get rid of this and replace it with some info about how we're going to trigger … |
maubin |
-
-
We're going to need tests for this, which will be especially important for any filtering logic and any future use of the broadcast channel.
-
I also want to discuss naming. Eventually, we'll want an open comm channel to the Review Board server as well. Is this going to be designed with the intent of being used for that as well? Or should we name this something more specific?
-
-
This is missing docs. Should also have
Version Added
, which I've unfortunately left out of my other TS reviews. -
- Description:
-
The new behavior for the unified banner means that individual tabs fetch
and keep track of pending review/draft IDs more eagerly than before. The result of this is that it was easier to hit bugs when performing actions with a review request open in multiple tabs. This change adds a small utility that makes use of the
BroadcastChannel
API to coordinate across multiple tabs/windows withina browser session. Right now the only message that we send is "reload", which asks other tabs to reload their contents. This is sent when something is either published or discarded, which invalidates draft IDs. + + The broadcast channel is origin-wide, so each
PageView
can implement a+ method to return a data blob that's used for filtering whether or not to + reload. The default implementation is empty, and ReviewablePageView
+ will filter based on the review request ID (so any open tabs related to + that review request will be triggered). - Testing Done:
-
~ - Published review requests, reviews, and replies from one tab, and saw
other tabs pop up the alert and reload.
~ - Discarded drafts from the unified banner and from the review dialog,
and saw other tabs pop up the alert and reload.
~ - Ran js-tests.
~ - Published review requests, reviews, and replies from one tab, and saw
other tabs pop up the alert and reload.
+ - Discarded drafts from the unified banner and from the review dialog,
and saw other tabs pop up the alert and reload.
- Published review requests, reviews, and replies from one tab, and saw
- Commits:
-
Summary ID 7df4b2f0db096ec892c1599ea37ce66517ca5cb6 8ac3ec8f6634c0d2b555cceaa5c8719d948a0228 - Diff:
-
Revision 2 (+494)
Checks run (2 succeeded)
- Commits:
-
Summary ID 8ac3ec8f6634c0d2b555cceaa5c8719d948a0228 1bbc4c4e7e9ba3cdd2e68c13c93a619834cb6771 - Diff:
-
Revision 3 (+498)