Fix post-deployment blank screen with proper cache headers and auto-r…#6205
Merged
alexwillingham merged 6 commits intodevelopfrom Feb 16, 2026
Merged
Conversation
…eload Set proper cache headers during S3 deployment to prevent stale bundle 404s: - index.html: no-cache (always fresh) - Hashed assets: max-age=31536000 (cached for 1 year, immutable) Add comprehensive chunk loading error detection and auto-reload for both EHR and Intake apps to handle edge cases where users still have cached old index.html files. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The generic "Failed to fetch" pattern could incorrectly trigger auto-reload on normal API call failures. Now only checking for specific chunk loading error patterns that won't interfere with runtime API calls. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses post-deployment “blank screen” incidents by reducing the chance of clients requesting deleted/stale JS chunks (via improved S3 cache-control headers) and by adding client-side detection of chunk load failures that triggers an automatic reload.
Changes:
- Add global chunk-load failure detection (window
error+unhandledrejection) with auto-reload in both Intake and EHR entrypoints. - Expand EHR’s existing
ErrorBoundaryhandling to detect more chunk-loading failure signatures. - Update Intake and EHR CI S3 deploy scripts to upload
index.htmlwithno-cacheand sync other files with long-lived cache headers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| apps/intake/src/index.tsx | Adds global handlers to detect chunk loading failures and reload the page. |
| apps/intake/package.json | Changes deploy scripts to set explicit cache-control headers for S3 uploads. |
| apps/ehr/src/index.tsx | Adds global handlers + expands ErrorBoundary reload logic for chunk loading failures. |
| apps/ehr/package.json | Changes deploy scripts to set explicit cache-control headers for S3 uploads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Window event listeners already catch all chunk loading errors globally. Keeping ErrorBoundary for general React error logging only. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
JavaScript error handlers can't catch main bundle 404s because the code never loads in the first place. The actual fix is ensuring index.html is never cached via proper Cache-Control headers on S3 deployment. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add ordered_cache_behavior blocks to both EHR and Patient Portal CloudFront distributions to disable caching for index.html using AWS's CachingDisabled policy. This ensures users always get the latest index.html after deployments, preventing blank screens from stale cached HTML with outdated bundle references. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
colin-welch
approved these changes
Feb 13, 2026
Contributor
Author
|
This requires some deploys to test, so let's be sure to check how it goes as we deploy it through various envs! |
VladMstv
approved these changes
Feb 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…eload
Set proper cache headers during S3 deployment to prevent stale bundle 404s:
Add comprehensive chunk loading error detection and auto-reload for both EHR and Intake apps to handle edge cases where users still have cached old index.html files.