feat(i18n): provide user feedback and robust fallback when locale fetch fails - #275
Open
Enemuo-debug wants to merge 1 commit into
Open
Conversation
…lback banner - retry locale fetch up to 3 attempts with exponential backoff - log every failed attempt and the final fallback via console.warn - render dismissible banner (role=alert) with Retry action when a locale fails - stop poisoning cache with English on failure; stale requests ignored - add vitest coverage for success, retry/backoff fallback, recovery and dismissal Closes cocor-tech#260
|
@Enemuo-debug is attempting to deploy a commit to the Nzubechukwu 's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Enemuo-debug Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #260
Summary
LocaleProviderno longer silently swaps to English when a locale fetch fails: failures are retried with backoff, logged, and surfaced to the user with a dismissible banner offering a retry.Changes
loadLocaleWithRetry()performs up to 3 attempts with exponential backoff (500ms, 1s); only successful responses are cached — the old code poisoned the cache with English forever after a single failurerole=alertbanner renders at the bottom of the viewport showing which locale failed, with Retry (re-attempts the load; recovers automatically once the network is back) and Dismiss actions; every failed attempt and the fallback itself are logged viaconsole.warnfallbackLocale,retryLocale()anddismissFallbackNotice()for programmatic usesrc/lib/locale/__tests__/context.test.tsxcovers success (no banner), retry/backoff then visible fallback with English served, recovery via the Retry button once fetch succeeds, and dismissal semanticsAcceptance criteria
npx vitest run src/lib/locale/__tests__/context.test.tsx— 4/4 passing)