Repository navigation
fix(i18n): guard template name lookups with t.has() to prevent MISSING_MESSAGE crash - #425
Conversation
…G_MESSAGE crash (closes #420) - reports/[id]/page.tsx: detail page header (crash site) - reports/page.tsx: reports list table cell - reports/page.tsx: generate dialog template picker Requires next-intl v4 t.has() API, already on ^4.8.3.
gkhngyk
left a comment
There was a problem hiding this comment.
The same stale-message scenario from #420 will still crash the generate dialog: templates.${tpl.id}.description on reports/page.tsx:308 is unguarded and lives in the same namespace. Could you add the t.has() guard there too (just hide the description when missing)? Everything else looks good.
Add t.has() guard for templates.${tpl.id}.description on reports/page.tsx
to prevent MISSING_MESSAGE crash when a template description key is absent,
matching the same guard already applied to the template name lookup.
Signed-off-by: Maqbool Ahmed <[email protected]>
Done! Added the |
gkhngyk
left a comment
There was a problem hiding this comment.
Description guard added — all template-namespace lookups are now covered. LGTM.
Fixes #420
Problem
Opening a report detail page crashed with: MISSING_MESSAGE: Could not resolve reports.templates.executive_summary.name in messages for locale en.
The key exists in
en.jsonbut was unresolvable at runtime due to a stale Turbopack module cache after switching branches without restarting the dev server.Fix
Added
t.has()guards at all three template-name render sites so a missing key silently omits the label instead of throwing:reports/[id]/page.tsx— detail page header (crash site):reports/page.tsx— reports list table cell:reports/page.tsx— generate dialog template picker (falls back totpl.id):Acceptance criteria
Notes
t.has()API — already on^4.8.3