-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[$500] Settings - Pronouns list is not translated dynamically #22089
Comments
Triggered auto assignment to @anmurali ( |
Bug0 Triage Checklist (Main S/O)
|
The same issue for User name. Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688245970202529 Recording.5296.mp4 |
ProposalPlease re-state the problem that we are trying to solve in this issue.PronounsPage search results do not update dynamically on changing locale from another device What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?We should add While some other prop can be added as dependency to get the same effect, it is ideal to add the same props that are used in the callback function so I think adding OptionalAlso in the above function whenever
Remove this in loadPronouns
Add dependency in loadPronouns
change the onChangeText in useEffect to
What alternative solutions did you explore?This last Result Screen.Recording.2023-07-03.at.7.56.38.AM.movApparently, en.js also includes other languages results, so results for English can be confusing. |
This is not related to this. Please post it as another bug. |
ProposalPlease re-state the problem that we are trying to solve in this issue.We want the pronouns list and search value to update dynamically whenever the preferred locale is change from another device What is the root cause of that problem?ATM we are not updating the pronouns list and search value in the PronounsPage, whenever the preferred locale changes. What changes do you think we should make in order to solve the problem?We should watch for the const loadPronouns = useCallback(() => {
// ... internal code
}, [props.currentUserPersonalDetails.pronouns, props.preferredLocale]); // add to dependency list What alternative solutions did you explore? (Optional)N/A |
@anmurali It is reproducible with 2 devices/browser tabs with these steps
|
@anmurali Hi, are you will not able to reproduce? I'm able to reproduce with many devices |
@anmurali Please check with the steps produced above. Also, videos clearly show the steps for the bug. Please check and reopen the issue as issues like these which are not updated dynamically are being fixed in all cases. |
@huzaifa-99 Did you check again with latest build? |
@kbecciv yes, just checked with Screen.Recording.2023-07-28.at.9.37.22.PM.mp4 |
bump @kbecciv |
Hello @huzaifa-99 @anmurali Coming back from OOO, checking if able to reproduce in latest build |
Reproduced on build 1.3.57-5 Recording.4031.mp4Screen_Recording_20230826_101413_Chrome.mp4 |
Hi, thank you for checking again @kbecciv (hope you had a great time during the holidays! 🙌) |
@anmurali Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Looks like still reproducible in latest build |
Since proposals from both @c3024 and @huzaifa-99 are very similar, I prefer the one from @huzaifa-99 - I believe adding 🎀 👀 🎀 C+ reviewed |
Triggered auto assignment to @MonilBhavsar, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
I see the point that
So, from a pure React perspective it is ideal to add the reactive values used in the hook to be added in the dependency array so props.translate being the reactive value used here appears to me is the right dependency to be added here.
We have similar examples here
and
and App/src/components/AttachmentModal.js Line 146 in 60c973d
and with useEffect hereApp/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSplitSelector.js Line 164 in aab0b22
and with useMemo hereApp/src/pages/iou/IOUCurrencySelection.js Line 127 in 60c973d
and
and many other places like PaymentMethodList , BaseLoginForm etc. in the repo where translate is added as a dependency and not preferredLocale because translate is the reactive value used in the hook.
Please see if this is worth considering and reconsider the review if using |
@c3024 In React docs the default setting recommended for the But maybe Expensify has different point of view here, so I'm curious about @MonilBhavsar opinion. P.S. I've checked the code and it seems that the |
I think my comment came off incorrectly. I didn't mean to add all dependencies used in a hook to the array mandatorily. I just meant that if we were to add a prop to the dependency array it might make more sense to add the exact prop used in hook that is translate here. I also found this principle followed on the repo at many other places. I was unaware of the inefficiency of translate as it exists now. If it is inefficient, then refactoring translate or all the hooks with one of the dependencies as translate might be worth the effort. |
Just to inform: I'll be OOO on Thursday and Friday (7-8 September). |
ProposalPlease re-state the problem that we are trying to solve in this issue.Changing language does not update pronouns list accordingly. What is the root cause of that problem?Currently, we're filtering the pronouns list based on App/src/pages/settings/Profile/PronounsPage.js Lines 81 to 87 in 34d4e54
What changes do you think we should make in order to solve the problem?There's another issue relating to locale change for emoji suggestion list here #25735 where they've concluded that searching in English should also display the Spanish result and vice versa. Add another pronouns list holding the translated version of const translatedFilteredPronounsList = useMemo(
() =>
_.map([...filteredPronounsList], (pronous) => ({
...pronous,
text: props.translate(`pronouns.${pronous.keyForList}`),
})),
[filteredPronounsList, props.preferredLocale],
); Note: Some limitations if we only add
Screen.Recording.2023-09-06.at.21.33.08.mov
ResultScreen.Recording.2023-08-25.at.16.35.34-compressed.mov |
I see we have mixed use of translate and props.preferredLocale in dependencies. I don't think we have a rule here. we can discuss in slack in #expensify-opensource, and agree on using one dependency. |
@burczu My proposal was a little bit late, but can you take a look? |
Awaiting reviews |
@burczu, @anmurali, @MonilBhavsar Whoops! This issue is 2 days overdue. Let's get this updated quick! |
I don't think what applies to searching emojis applies also to searching for pronouns... Also I have concerns about the "vice versa" part of your comment - for emojis they wanted to allow searching in english if you set spanish, but not allowing searching in spanish when you set language to english. This behaviour for emojis seems reasonable but for regular search it is strange... What do you think @MonilBhavsar? |
It appears that the page was refactored and changed significantly and |
@c3024 You mean it's fixed already? |
Yes |
Ok, I'll test it later to confirm. |
@burczu did you get a chance to take a look? |
@MonilBhavsar sorry for the delay - I have quite a lot on me now. I'll check it today. |
@MonilBhavsar Re-tested and I can confirm it's fixed now. |
So we can close this I believe? Based on #22089 (comment) Please reopen if I misunderstood. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
The Pronouns list should translated dynamically, currently it does only if you click back and navigate to Pronouns settings again
Actual Result:
The Pronouns list is not translated dynamically
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.35-5
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
9.New.Expensify.-.1.July.2023.1.mp4
Recording.3372.mp4
Expensify/Expensify Issue URL:
Issue reported by: @mejed-alkoutaini
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1688240365001069
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: