-
Notifications
You must be signed in to change notification settings - Fork 3k
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 NVP_HOLD_USE_EXPLAINED useOnyx wrong config #42819
Conversation
@techievivek 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] |
@@ -52,7 +52,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, shouldUseNarrow | |||
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${(parentReportAction as ReportAction & OriginalMessageIOU)?.originalMessage?.IOUTransactionID ?? 0}`); | |||
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS); | |||
const [session] = useOnyx(ONYXKEYS.SESSION); | |||
const [shownHoldUseExplanation] = useOnyx(ONYXKEYS.NVP_HOLD_USE_EXPLAINED, {initWithStoredValues: false}); | |||
const [shownHoldUseExplanation] = useOnyx(ONYXKEYS.NVP_HOLD_USE_EXPLAINED, {initialValue: false}); |
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.
initWithStoredValues is "true by default", so we don't need to set it explicitly.
Btw, @DylanDylann do you know what issue this causes so I can test it?
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.
@bernhardoj The initial value should be 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.
@bernhardoj What is difference between initWithStoredValues and initialValue
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.
If initWithStoredValues is false, it won't use the stored values, so it will return undefined, but it will still receive the update.
initialValue will be used if the data is not ready yet. So in this case, it will be false first and then true.
@techievivek fyi, this is a follow up from #42334 |
@bernhardoj The current bug: When you first load the page, the hold education modal will appear for a bit and then close automatically. Because |
…hold education modal
if (isLoadingHoldUseExplained) { | ||
return; | ||
} | ||
setShouldShowHoldMenu(isOnHold && !holdUseExplained); |
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.
I have found the code that causes the issue and pushed a new fix. We can't set the prop default value as the onyx initial value because it will be used when the data is still loading by the onyx. Instead, I do an early return when the data is still loading.
Thanks, I can repro it and have added the test step and recordings. |
@DylanDylann sorry, just to confirm, you are going to review this one, right? |
Gentle bump @DylanDylann to review the PR. |
Whoops, I missed this PR. Sorry |
@bernhardoj Could you explain why we should remove initial value of |
I mentioned it here why. |
Oh, thanks. LGTM 💯 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeScreen.Recording.2024-06-10.at.17.21.05.moviOS: NativeiOS: mWeb SafariScreen.Recording.2024-06-10.at.17.19.38.movMacOS: Chrome / SafariScreen.Recording.2024-06-10.at.17.18.38.movMacOS: DesktopScreen.Recording.2024-06-10.at.17.25.56.mov |
@bernhardoj The popover still displays for the first time going to the transaction report after login again Screen.Recording.2024-06-10.at.17.23.24.mov |
NVP_HOLD_USE_EXPLAIND is saved locally only, so if you log out or switch devices, the value is false. You can check the value in the storage. |
Updated: Wrong video @bernhardoj I see the status is Screen.Recording.2024-06-10.at.17.25.56.mov |
@bernhardoj I don't understand your mean |
If you relogin, NVP_HOLD_USE_EXPLAIND doesn't exist on onyx, so the hold modal shows again. App/src/components/MoneyRequestHeader.tsx Lines 174 to 176 in 66cd707
so |
Ok, I see. I get confused about above comment |
🎯 @DylanDylann, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #43350. |
@techievivek All yours |
✋ 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 production by https://github.com/mountiny in version: 1.4.83-3 🚀
|
Details
There is a wrong config being set for NVP_HOLD_USE_EXPLAINED in MoneyRequestHeader. This PR fix it.
Fixed Issues
$ #42334 (comment)
PROPOSAL:
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisite:
Steps:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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
Screen.Recording.2024-05-30.at.17.27.12.mov
Android: mWeb Chrome
Screen.Recording.2024-05-30.at.17.21.47.mov
iOS: Native
Screen.Recording.2024-05-30.at.17.26.52.mov
iOS: mWeb Safari
Screen.Recording.2024-05-30.at.17.23.59.mov
MacOS: Chrome / Safari
Screen.Recording.2024-05-30.at.17.11.48.mov
MacOS: Desktop
Screen.Recording.2024-05-30.at.17.19.42.mov