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

LF-4038: The app crashes on the home page once the user saves the user profile without preferred language #3098

Conversation

SayakaOno
Copy link
Collaborator

@SayakaOno SayakaOno commented Jan 29, 2024

Description

When the user with a non-LF language changes their profile without setting a language, language_preference becomes undefined in the Redux store and the litefarm_lang key in local storage is set to undefined in saga, which causes a crash in the home page. (Thank you Joyce!)

formatDate(lang, dte) {
return new Date(dte * 1000).toLocaleDateString(lang, {
weekday: 'short',
day: 'numeric',
month: 'long',
});
},

(⬆️ lang being undefined causes a crash)

Changes

  • update useLanguageOptions hook to keep language_preference as is. Currently the selected option is becoming null for a non-LF language.
  • add option tag to the last name input label.

NOTE:
I realized that the selected gender does not reflect the newly saved language preference, so I created a ticket

Jira link: https://lite-farm.atlassian.net/browse/LF-4040

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@SayakaOno SayakaOno added the bug Something isn't working label Jan 29, 2024
@SayakaOno SayakaOno self-assigned this Jan 29, 2024
@SayakaOno SayakaOno requested review from a team as code owners January 29, 2024 22:51
@SayakaOno SayakaOno requested review from antsgar and kathyavini and removed request for a team January 29, 2024 22:51
@SayakaOno SayakaOno force-pushed the LF-4038/The_app_crashes_on_the_home_page_once_the_user_saves_the_user_profile_without_preferred_language branch from 769fcfe to b4ec5f9 Compare January 29, 2024 22:58
Copy link
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

I like this solution a lot, particularly how it stays within the pure component ☺️

Just to clarify on the PR description... it's the Redux entity becoming undefined here in this component that causes the crash, but only because the litefarm_lang key in local storage is set from it in the submit saga, right? I tried to search up if language was ever pulled from Redux itself and I couldn't find any cases outside of this component.

@SayakaOno
Copy link
Collaborator Author

@kathyavini Thank you!! I had not checked where the lang was coming from. I updated the description :)

Copy link
Collaborator

@antsgar antsgar left a comment

Choose a reason for hiding this comment

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

Looks good, thank you for fixing it!

@antsgar antsgar merged commit a1e6689 into integration Jan 30, 2024
4 checks passed
@antsgar antsgar deleted the LF-4038/The_app_crashes_on_the_home_page_once_the_user_saves_the_user_profile_without_preferred_language branch January 30, 2024 13:20
antsgar added a commit that referenced this pull request Jan 30, 2024
…the_home_page_once_the_user_saves_the_user_profile_without_preferred_language

LF-4038: The app crashes on the home page once the user saves the user profile without preferred language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants