fix(login): reload on version mismatch to serve fresh assets#12538
Open
fix(login): reload on version mismatch to serve fresh assets#12538
Conversation
|
Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:
|
|
ℹ️ Coverage metrics explained: |
📊 commons test coverage |
📊 events test coverage |
Contributor
|
Your environment is deployed to https://ocrvs-12497.e2e-k8s.opencrvs.dev |
Contributor
…ale bundle/config mismatch
Zangetsu101
approved these changes
May 8, 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.

Description
Problem
Two separate issues cause infinite spinners after deployment.
Login app: On deployment, the cached JS bundle has an older APP_VERSION than the newly deployed gateway's X-Version header. The withRetry loop in index.tsx calls getApplicationConfig() before the app ever renders. When a version mismatch is detected, it throws VERSION_MISMATCH — withRetry catches it and retries silently forever, root.render() is never called, and the user sees a permanent blank loading screen.
Registration app: On mount, probeNetwork() in the V2 routes component immediately sets onlineManager.setOnline(false), pausing all TanStack Query queries. If the /api/ping probe fails (gateway briefly restarting during deployment), the catch block left onlineManager as false permanently. Queries with networkMode: 'online' never unpause, resulting in a blank/spinner screen in the workqueue area.
Fix
Login app (packages/login/src/index.tsx): On VERSION_MISMATCH, reload the page instead of retrying. The service worker uses skipWaiting() so the new SW is already active — a reload serves fresh assets matching the new backend. A sessionStorage counter caps reloads at 3 to prevent infinite reload loops in edge cases.
Registration app (packages/client/src/v2-events/routes/config.tsx): Move onlineManager.setOnline(true) into a finally block so it always runs regardless of whether the probe succeeds or fails. A failed probe means the server is temporarily unreachable — queries should still be allowed to run and handle their own retries rather than being permanently paused.
Checklist