NutsNews Hydration Language Fix
Section titled “NutsNews Hydration Language Fix”This update fixes a homepage hydration mismatch caused by the hero tagline reading localStorage during the first client render.
Before the fix, the server rendered English text, but the client could render French or Japanese immediately if that language was stored in the browser. React then reported a server/client text mismatch.
Changes:
-
web/app/components/HeroTagline.tsx- Uses the existing
useSelectedLanguage()hook. - The first client render matches the server default language.
- The saved language is applied after hydration.
- Uses the existing
-
web/next.config.ts- Adds image quality
72toimages.qualitiesso Next.js accepts the existing article image quality setting.
- Adds image quality
Test:
cd /Users/ramideltoro/WebstormProjects/nutsnews3/webnpm run lintnpm run buildnpm run devThen open the homepage, switch languages, and confirm the hydration error is gone.
