App icon indicating copy to clipboard operation
App copied to clipboard

Timestring is not being properly set on Refreshing the tab when the Language is English

Open aman-atg opened this issue 5 years ago • 16 comments

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:

  1. Go to newDot
  2. Open any chat
  3. Refresh the page
  4. timestring will update from Spanish to English even when the Language is set to English

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:

View all open jobs on Upwork

aman-atg avatar Aug 04 '21 09:08 aman-atg

Triggered auto assignment to @lschurr (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

MelvinBot avatar Aug 04 '21 09:08 MelvinBot

Proposal

Explaination

  • This is a regression which is most likely caused by this https://github.com/Expensify/App/commit/72800fc2b5ef004d246084ee80e5a3c2c9a8c5b4
  • Earlier we were getting preferredLocale inside props when we used withLocalize but after the above commit this.props.preferredLocale became undefined
  • And then locale was passed inside props for child comps. instead of preferredLocale after this https://github.com/Expensify/App/commit/69fd992846facea6aabcf7a15552f0cafd3f57b3
  • This is causing the moment.locale to take undefined as an argument here which was defined earlier to these commits https://github.com/Expensify/App/blob/f77283722983908fe69befe261a2449b9a2cec19/src/pages/home/report/ParticipantLocalTime.js#L44

Solution

  • We just need to rename locale to preferredLocale on this line https://github.com/Expensify/App/blob/f77283722983908fe69befe261a2449b9a2cec19/src/components/withLocalize.js#L59

aman-atg avatar Aug 04 '21 09:08 aman-atg

@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 avatar Aug 04 '21 10:08 parasharrajat

@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

aman-atg avatar Aug 04 '21 10:08 aman-atg

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?

parasharrajat avatar Aug 04 '21 11:08 parasharrajat

In this case we update "locale: this.props.preferredLocale" to "preferredLocale: this.props.preferredLocale" in "App/src/components/withLocalize.js"

arpitdeveloper avatar Aug 04 '21 11:08 arpitdeveloper

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

#4218 (comment)

aman-atg avatar Aug 04 '21 11:08 aman-atg

Is this a duplicate of this one then? https://github.com/Expensify/App/issues/4218

lschurr avatar Aug 04 '21 14:08 lschurr

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.

aman-atg avatar Aug 04 '21 14:08 aman-atg

@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.

parasharrajat avatar Aug 04 '21 14:08 parasharrajat

Triggered auto assignment to @Luke9389 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 04 '21 15:08 MelvinBot

Tagging Eng for another set of eyes.

lschurr avatar Aug 04 '21 15:08 lschurr

@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).

Luke9389 avatar Aug 04 '21 21:08 Luke9389

@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 avatar Aug 05 '21 07:08 kidroca

@kidroca No problem mate!

aman-atg avatar Aug 05 '21 07:08 aman-atg

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!

MelvinBot avatar Sep 02 '21 19:09 MelvinBot