mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(coach): surface offline hint when network drops mid-stream
This commit is contained in:
1 parent
13f4880f0c
commit
373515c1f1
8 files changed
+20
-2
No files matched your search
@@ -528,13 +528,20 @@ describe("errorCodeToI18nKey", () => {
|
||||
"coach.provider.unavailable",
|
||||
"coach.provider.empty",
|
||||
"coach.provider.none",
|
||||
"coach.network",
|
||||
"coach.stream",
|
||||
]) {
|
||||
expect(errorCodeToI18nKey(code)).toBe("insights.coach.errorProvider");
|
||||
}
|
||||
});
|
||||
|
||||
// v1.4.43 QoL (M6) — `coach.network` no longer collapses to the
|
||||
// generic provider copy; the user needs the actionable offline hint.
|
||||
it("maps coach.network to the dedicated offline key", () => {
|
||||
expect(errorCodeToI18nKey("coach.network")).toBe(
|
||||
"insights.coach.errorNetwork",
|
||||
);
|
||||
});
|
||||
|
||||
it("forward-compats unknown codes with the namespaced key", () => {
|
||||
expect(errorCodeToI18nKey("errorProvider")).toBe(
|
||||
"insights.coach.errorProvider",
|
||||
|
||||
@@ -82,10 +82,15 @@ export function errorCodeToI18nKey(code: string): string {
|
||||
return "insights.coach.dailyLimitBody";
|
||||
case "coach.provider.rate_limited":
|
||||
return "insights.coach.providerRateLimitBody";
|
||||
case "coach.network":
|
||||
// v1.4.43 QoL (M6) — a dropped network is the user's local
|
||||
// problem and needs a different next action ("come back online")
|
||||
// than a provider failure ("try again in a moment"). Split out
|
||||
// so the user sees the actionable copy in the offline branch.
|
||||
return "insights.coach.errorNetwork";
|
||||
case "coach.provider.unavailable":
|
||||
case "coach.provider.empty":
|
||||
case "coach.provider.none":
|
||||
case "coach.network":
|
||||
case "coach.stream":
|
||||
return "insights.coach.errorProvider";
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user