Skip to content
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 language selector #3638

Merged
merged 3 commits into from Jun 17, 2021
Merged

Fix language selector #3638

merged 3 commits into from Jun 17, 2021

Conversation

roryabraham
Copy link
Contributor

@roryabraham roryabraham commented Jun 17, 2021

cc @jasperhuangg

Details

There were a few issues here:

  1. The preferences prop was not being provided
  2. We were using Onyx.merge instead of Onyx.set (not a problem per-se but weird for a value that's just a singular string)
  3. We were using Onyx.merge inline in a component callback instead of via an action.
  4. The Picker component is infuriating and triggers the onChange callback multiple times.

I'm not 100% sure what was causing the crash, but _after hooking up preferredLocale via Onyx, I was getting an infinite loop where:

  1. User triggers onChange to update preferred locale in Onyx
  2. Onyx updates preferred locale in Picker
  3. onChange is triggered again (because the preferredLocale had changed), and this would restart the loop.

Fixed Issues

Fixes #3606

Tests / QA Steps

  1. Open Settings -> Preferences, and toggle the preferred locale.
  2. Verify that the language of the app switches from English -> Spanish, or vice-versa.
  3. Repeat the previous two steps.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

image
image

Mobile Web

image
image

Desktop

image
image

iOS

image
image

Android

@roryabraham roryabraham self-assigned this Jun 17, 2021
@roryabraham roryabraham requested a review from a team as a code owner June 17, 2021 15:48
@MelvinBot MelvinBot requested review from robertjchen and removed request for a team June 17, 2021 15:48
Copy link
Contributor

@robertjchen robertjchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid! 👍

@robertjchen robertjchen merged commit dbe484c into main Jun 17, 2021
@robertjchen robertjchen deleted the Rory-FixLanguageSelector branch June 17, 2021 19:53
@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.70-7🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.73-3🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants