Skip to content

feat(i18n): provide user feedback and robust fallback when locale fetch fails - #275

Open
Enemuo-debug wants to merge 1 commit into
cocor-tech:masterfrom
Enemuo-debug:feat/locale-fetch-fallback-retry-260
Open

feat(i18n): provide user feedback and robust fallback when locale fetch fails#275
Enemuo-debug wants to merge 1 commit into
cocor-tech:masterfrom
Enemuo-debug:feat/locale-fetch-fallback-retry-260

Conversation

@Enemuo-debug

Copy link
Copy Markdown

Closes #260

Summary

LocaleProvider no 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

  • Retry logic: new 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 failure
  • Surface fallback: on final failure a role=alert banner 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 via console.warn
  • Robustness: stale responses are ignored via a request counter so rapid locale switches can't apply out-of-order results; context now also exposes fallbackLocale, retryLocale() and dismissFallbackNotice() for programmatic use
  • Tests: src/lib/locale/__tests__/context.test.tsx covers success (no banner), retry/backoff then visible fallback with English served, recovery via the Retry button once fetch succeeds, and dismissal semantics

Acceptance criteria

  • Surface fallback (banner + log)
  • Retry logic
  • Tests (npx vitest run src/lib/locale/__tests__/context.test.tsx — 4/4 passing)

…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
@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

@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.

@drips-wave

drips-wave Bot commented Aug 24, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(i18n): provide user feedback and robust fallback when locale fetch fails

1 participant