Fix: HMR locale messages flash#4010
Conversation
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThe dev-mode plugin ( Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔗 Linked issue
Fix: #4009
📚 Description
Editing locale files in dev could briefly render raw translation keys because locale messages were reset before async reload completed. This updates the HMR reset path to compute the next locale payload first, then replace composer messages in a single write.
Root cause
resetI18nProperties()calledsetLocaleMessage(..., {})(or base-only config) beforeloadMessages, creating a reactive empty/intermediate state during locale-file HMR.Runtime plugin update (
src/runtime/plugins/dev.ts)localeLoaders,getLocaleMessagesMerged, anddeepCopy.getLocaleMessagesMerged(locale, localeLoaders[locale])setLocaleMessageonce with the merged resultBehavioral impact
Summary by CodeRabbit