-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: unicode parsing #2030
fix: unicode parsing #2030
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2030 +/- ##
==========================================
+ Coverage 76.65% 80.05% +3.40%
==========================================
Files 81 85 +4
Lines 2090 2146 +56
Branches 533 548 +15
==========================================
+ Hits 1602 1718 +116
- Misses 375 412 +37
+ Partials 113 16 -97 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, imho we don't need the same block twice.
Description
In
js-lingui/packages/core/src/interpolate.ts
there is a regular expression to test if the string has unicode values inside, it has theg
flag which makes that Regexp stateful. If you render the same string twice in a row, Lingui will not parse the string a second time, because thelastIndex
for that string will be after the Unicode symbol at that point. And since there is no need to keep thelastIndex
state, no need for ag
flag here.The bug is reproducible, for example, in React with the StrictMode enabled.
Types of changes
Fixes #2028
Checklist