Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status

In progress

Author(s)

Joyce Sato-Reinhold

Updated

2023-12-1213

Related Jira Ticket

Jira Legacy
serverSystem JIRA
serverId815f41e5-e5fb-3402-8587-82eccc3ffab0
keyLF-3319

...

  • No service worker has ever become active

  • (As an aside, you can see the original service worker halt install as soon as the new webapp Docker container goes up! The detection is actually instant!)

  • Because the webapp has already been loaded into browser memory (with all its references to old js files), as soon as the new webapp container is live, those old assets are non-existent and all routing fails

  • The PWA would have helped this situation by keeping the old files in Cache storage even when they were not on the server, but in this case (due to slow network), the PWA never finished caching the resources, so they were simply never available to this user

Video #5 (Failed to fetch crash reproductions testing patch) - December 13, 2023 – status: would only occur in this manner until one user page refresh

...

This story is a little bit different than in Video #4 because a service worker is installed. Also LiteFarm’s configuration is now the same as the code in Videos #3 and Video #3b above, but this is the PR that is implementing the nginx changes, as opposed to one PR afterwards. In other words, the nginx changes are most likely not applicable to the currently served pwa files, which were requested before the container was rebuilt and are now in browser memory.

  • An old service worker had been active (as opposed to absent as in Video #4)

  • We are looking at a (mostly) cached version of the webpage

    • This is an aside, but an important one for explaining what we saw today: translations are not part of the cache (because in the built webapp they are in /locales not in /dist) and are always network requested.

  • Installation finishes and navigation crashes

    • If this were reproducible, with this timing, with the correct nginx configuration already applied before the vite build, I would be tempted to blame the service worker lifecycle cleaning up the oudated cache too soon

    • However because there is no such crash in Videos #3 and Video #3b (the cached webapp is entirely stable to navigate, even when the next service worker is installed), I think this crash is still on us and our faulty nginx config


This crash could be prevented by:

  • The updated nginx, which will take effect presumably the next time sw.js, the webmanifest, or the never-expiring assets are requested, which is not under our control because of our previous nginx config did not specify a timecourse for these files

  • Refreshing after install (before navigation), as happens with the registerSW change in root

  • Error boundary around routing

But because all of these changes require new frontend code, the only way to prevent it entirely for the build that implements any/all these is to serve old assets for a period of time.

Redux + Redux-Persist

The persist:root data object created and kept in local storage by redux-persist was originally considered the root of the whitescreen crashes (see comments of

Jira Legacy
serverSystem JIRA
serverId815f41e5-e5fb-3402-8587-82eccc3ffab0
keyLF-3319
). However, during the forced logout of our current release process, this object is completely purged from local storage:

...