kiwix-js-pwa icon indicating copy to clipboard operation
kiwix-js-pwa copied to clipboard

Article opened in new window in PWA sometimes fails to be unhidden in SW mode

Open Jaifroid opened this issue 2 years ago • 1 comments

This is undoubtedly a timing issue. To prevent excessive flashing of wrong theme (light/dark), the document is hidden while loading, and should be revealed once the correct theme and CSS is applied. However, opening in a new tab/window is significantly slower, and it seems the unhiding gets out of sequence for some page loads. The page is clearly loaded into the new window, and the HTML can be inspected, but the entire document remains hidden. The randomness of this suggests a race condition, with faster-loading documents unaffected.

In jQuery mode clearly the timing is better orchestrated, and I do not see this issue in that mode. Given that the default for the PWA is now SW mode, this could impact users.

Workaround for now is to switch back to jQuery mode.

Jaifroid avatar Feb 18 '22 07:02 Jaifroid

I should add that the UWP and Electron apps do not suffer from this issue, it affects specifically the standalone PWA. UWP and Electron apps are much faster to load and communicate with a new window, which would appear to confirm that this is a timing issue.

Jaifroid avatar Feb 18 '22 07:02 Jaifroid