Timestring is not being properly set on Refreshing the tab when the Language is English
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Details
https://github.com/Expensify/App/issues/4218#issuecomment-892122092
Action Performed:
- Go to newDot
- Open any chat
- Refresh the page
timestringwill update fromSpanishtoEnglisheven when the Language is set toEnglish
Expected Result:
It should show the timestring in the language that is set.
Actual Result:
https://user-images.githubusercontent.com/28243942/128154124-6e5dea4f-3653-4c62-b773-12f344ee61f0.mp4
Workaround:
Visual Issue.
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number: Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation Expensify/Expensify Issue URL:
Triggered auto assignment to @lschurr (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.
Proposal
Explaination
- This is a regression which is most likely caused by this https://github.com/Expensify/App/commit/72800fc2b5ef004d246084ee80e5a3c2c9a8c5b4
- Earlier we were getting
preferredLocaleinsidepropswhen we usedwithLocalizebut after the abovecommitthis.props.preferredLocalebecameundefined - And then
localewas passed inside props forchild comps.instead ofpreferredLocaleafter this https://github.com/Expensify/App/commit/69fd992846facea6aabcf7a15552f0cafd3f57b3 - This is causing the
moment.localeto takeundefinedas anargumenthere which wasdefinedearlier to these commits https://github.com/Expensify/App/blob/f77283722983908fe69befe261a2449b9a2cec19/src/pages/home/report/ParticipantLocalTime.js#L44
Solution
- We just need to rename
localetopreferredLocaleon this line https://github.com/Expensify/App/blob/f77283722983908fe69befe261a2449b9a2cec19/src/components/withLocalize.js#L59
@aman-atg would you mind commenting of the PR that caused the regression? It will help everyone.
Thanks for taking the time to find the issue and creating a ticket for it
@parasharrajat It's the same PR that caused https://github.com/Expensify/App/issues/4352. The issue it solved is #4268.
The last PR also couldn't fix it.
I have mentioned commits here https://github.com/Expensify/App/issues/4404#issuecomment-892506251 for a better understanding
Yeah, that's why to fix this regression another PR should be made by the original author. Don't you think so?
Could you please mention/tag the respective persons who found the original issue?
In this case we update "locale: this.props.preferredLocale" to "preferredLocale: this.props.preferredLocale" in "App/src/components/withLocalize.js"
Yeah, that's why to fix this regression another PR should be made by the original author. Don't you think so?
There're many instances when regressions are fixed as Separate issues when found out later after the PR is merged. But I don't think that I'm eligible to answer that question. Someone will surely clarify later.
Could you please mention/tag the respective persons who found the original issue?
I've already provided context in the ticket itself.
Details
Is this a duplicate of this one then? https://github.com/Expensify/App/issues/4218
No. In that issue we were not showing Spanish version at all.
And currently the English version is being updated with a delay in this Issue.
@lschurr I see that Changes here https://github.com/Expensify/App/pull/4366 caused this issue.
As @aman-atg mentioned https://github.com/Expensify/App/issues/4404#issuecomment-892506251.
That prop name was renamed in that PR to locale.
Triggered auto assignment to @Luke9389 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
Tagging Eng for another set of eyes.
@parasharrajat is correct in saying this should be fixed by the original author. We always wait 7 days to pay our contributors so that we can find regressions like this one. The PR we've been linking to is actually another regression fix from this original one, which was only merged 5 days ago.
Thus I think @kidroca should make this change (it's a tiny one-liner change but that's our process).
@aman-atg
Thanks for the info, I'll submit another PR
I've missed that previously preferredLocale was along the ...props spread
I've only passed locale to trigger re-render when it changes, I had no idea it was actually used in the child components...
@kidroca No problem mate!
This issue has not been updated in over 15 days. @Luke9389 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!