Remove all usage/reference of the User model and ONYXKEYS.USER#61228
Remove all usage/reference of the User model and ONYXKEYS.USER#61228
Conversation
|
@ Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@inimaga , thanks. I am on it. |
src/components/BookTravelButton.tsx
Outdated
| const {translate} = useLocalize(); | ||
| const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false}); | ||
| const isUserValidated = useAccountValidation(); | ||
| const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.validated, canBeMissing: true}); |
There was a problem hiding this comment.
We have already subscribed to ACCOUNT Onyx key for primaryLogin. I think it is better to have only one useOnyx connection for each key.
There was a problem hiding this comment.
Good catch. I agree. Adding the changes now.
| const [isLoadingPaymentMethods] = useOnyx(ONYXKEYS.IS_LOADING_PAYMENT_METHODS, {initialValue: true, canBeMissing: true}); | ||
| const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET, {canBeMissing: true}); | ||
| const [walletTerms] = useOnyx(ONYXKEYS.WALLET_TERMS, {initialValue: {}, canBeMissing: true}); | ||
| const [isUserValidated] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.validated, canBeMissing: true}); |
There was a problem hiding this comment.
Here too we can use only one useOnyx for ACCOUNT for the page.
There was a problem hiding this comment.
Resolved. Also fixed it retrospectively for ProfilePage.tsx
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppaccountAndroid.movAndroid: mWeb ChromeaccountAndroidmWeb.moviOS: mWeb SafariaccountiOSmWeb.movMacOS: Chrome / SafariaccountChrome.mp4MacOS: DesktopaccountDesktop.mp4 |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/MariaHCD in version: 9.1.39-0 🚀
|
|
Just a heads up, that the changes here caused a small bug - #61275 |
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.1.39-8 🚀
|

Explanation of Change
Context: We have two models in the App that essentially represent the same thing: User and Account and this leads to a risk of duplicated information. We are thus in the process of deprecating User.ts and merge it into Account.ts to standardise and prevent duplicate information from being added to both models.
Change: This change is step D of the entire process listed here. i.e: Remove all usage/reference of the User model and ONYXKEYS.USER in the frontend (App).
In this change, we have:
Fixed Issues
Part of #59277
Tests
Test to ensure that removal of the hook didn't regress the following bug/issue at #58682
Steps:
Offline tests
N/A
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop