-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Remove all usage/reference of the User model and ONYXKEYS.USER #61228
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
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
@@ -51,7 +50,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B | |||
const StyleUtils = useStyleUtils(); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too we can use only one useOnyx
for ACCOUNT
for the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
✋ 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop