Now, in terms of performance. The live update mode generates a lot of requests. Those requests keep happening even when the browser tab is in the background. This must be changed to requests only happening when the current page/tab is in focus. There's no point running those updates for a tab that the user doesn't see.
Refs / code to draw from / things to consider
- ContentTranslation code - appears to depend on page visibility api, probably the easiest to implement
- EventLogging code - has some handling for browsers that don't implement the page visibility api
Of the supported browsers, the desktop browsers allow using the pagevisibility api, but the mobile ones don't always
- Safari (MW supports 5.1+, only available in 6.1+)
- iOS (MW supports 6.1+, only available in 7+)
- Android (MW supports 4.1+, only available in 81+ (though the numbering system changed in between))
T229239: Refresh target browser support for MW, dropping less-used browsers from Grade A to Grade C would solve the Safari and iOS support by dropping the versions that don't support the api
Not sure how to handle android
...that being said, this is geared towards desktops, not mobile views, and is not critical, so adding this handling when the page visibility api is available is better than nothing
Event handler should be attached in the "On ready initialization" for SpecialGlobalWatchlist.display.js, and in mounted for the vue version. If the visibility is hidden, and live updates is true, should set to paused, and if it is visible, and live updates is paused, should set it back to true.