community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

fix: remove service-worker caching for index (WHITE SCREEN OF DEATH 🔥👻)

Open thisislawatts opened this issue 3 years ago • 4 comments

PR Checklist

PR Type

  • [X] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Developer experience (improves developer workflows for contributing to the project)

Description

The Problem

Regular visitors to the site are intermittently presented with a blank screen. This is because the primary JS/CSS bundles have failed to load.

Proposed Workaround

The service worker should not cache the index.html page as this is the entry point to our service which contains the manifest for which JS files to load.

After each deployment, the old JS files are removed from the server. As a result the index.html loaded from cache by the service worker can include references to JS files which no longer exist.

Screenshot 2022-05-18 at 19 51 00

Q. How can I verify that a stale HTML file was the root cause? A. I checked the REACT_APP_PROJECT_VERSION variable injected during build time and observed that the sha 0a2475d054a016d5ed3642c6abc299978c9ace12 was several deployments behind the head when compared with GitHub.

thisislawatts avatar May 18 '22 18:05 thisislawatts

@chrismclarke I welcome your perspective here! I am still young in the ways of Service Worker(TM). To demonstrate my point I have broken all of the tests. 🤔

thisislawatts avatar May 18 '22 18:05 thisislawatts

Haha, yeah I might need to revisit this one next week. It's a perennial issue, I've been forever subscribed to the thread https://github.com/facebook/create-react-app/issues/5316 and saw a couple new posts over the weekend with some more ideas.

My other thought would be to look at including a specific within the error boundary (although not sure if the error boundary would load if main chunk failing...)

chrismclarke avatar May 19 '22 11:05 chrismclarke

That would be great @chrismclarke, it would be great to see away with this screen of doom.

thisislawatts avatar May 19 '22 19:05 thisislawatts

This issue is still affecting the platform, but closing due to lack of interest. Perhaps better represented as an Issue.

thisislawatts avatar Sep 21 '22 19:09 thisislawatts

Sounded interesting! But I do think we got the "Report Feedback" page more often, as a comment from users.

davehakkens avatar Sep 21 '22 19:09 davehakkens