i18n: add warning if falling back to default translation#8164
i18n: add warning if falling back to default translation#8164mimecuvalo merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
5 Skipped Deployments
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| const messages = translation?.messages ?? DEFAULT_TRANSLATION | ||
| if (!translation?.messages) { | ||
| console.warn('No translation messages found, falling back to default translation.') | ||
| } |
There was a problem hiding this comment.
Console warning fires on every render cycle
Medium Severity
The console.warn is placed directly in the render body of the useTranslation hook rather than inside a useEffect. This means it fires on every single render of every component calling useTranslation() when the fallback condition is met. Given this hook is used in many components across the codebase, this will spam the console with repeated warnings on each re-render, making it noisy and potentially impacting dev-mode performance.
bah, whoops, followup again #8164 (review) ### Change type - [ ] `bugfix` - [ ] `improvement` - [ ] `feature` - [ ] `api` - [x] `other` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: only changes when the fallback `console.warn` fires, moving it out of render and preventing repeated warnings on re-renders. > > **Overview** > Moves the "falling back to default translation" warning in `useTranslation` from render-time to a `useEffect` keyed on `translation?.messages`, so the warning only emits when messages are missing (or change to missing) rather than on every render. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 87ae187. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->


followup to #8011
tiny nit feedback from @MitjaBezensek
Change type
bugfiximprovementfeatureapiotherNote
Low Risk
Low risk: adds a
console.warnwhenuseTranslationcannot find translation messages, which may increase log noise but does not change translation lookup behavior.Overview
useTranslationnow emits aconsole.warnwhen no translation messages are present and it falls back toDEFAULT_TRANSLATION, making missing/incorrect translation provider setup more visible during development.Written by Cursor Bugbot for commit cd95cda. This will update automatically on new commits. Configure here.