-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: 26945 Android-IOU-Distance IOU amount is auto-filled and displayed in manual request money page #28120
Conversation
@cubuspl42 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] |
} | ||
|
||
resetMoneyRequestInfo(); | ||
// resetMoneyRequestInfo function is not added as dependencies since they don't change between renders |
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.
Is this a necessary optimization?
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.
Yes, we don't need to call resetMoneyRequestInfo when resetMoneyRequestInfo get changed
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 asked whether it was a necessary optimization. Disabling the exhaustiveness check for this dependency array is forever, for this dependency and for other potential future dependencies.
In other words, does it do any harm to include resetMoneyRequestInfo
in the deps? As I see it, you didn't answer this question.
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 asked whether it was a necessary optimization. Disabling the exhaustiveness check for this dependency array is forever, for this dependency and for other potential future dependencies.
we're getting iouType and reportID from route, so they are not changed for every re-renders. Currently, in resetMoneyRequestInfo function we're using iouType and reportID, but not wrap it in useCallback, that why resetMoneyRequestInfo function will be created to the new one for every re-renders.
If we want to put resetMoneyRequestInfo in the dependency, we have to wrap resetMoneyRequestInfo, reportID and iouType in useCallback/useMemo, but it can make our code complex and less readable. Beside I see other places in our app still use react-hooks/exhaustive-deps
Do you think we should use useCallback/useMemo here?
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.
First, I'm trying to ensure that we're in agreement on whether this is an optimization that can be done or something that had to be done because otherwise the app behavior would be incorrect.
As I understand it, this the first case.
After giving it a thought, you might be right that silencing the lint might be acceptable here. It's a pity one can't disable this exhaustiveness check more granually, like (pseudo-code):
// eslint-config react-hooks/exhaustive-deps {resetMoneyRequestInfo: false}
Mention that the expected result is 0 |
Reviewer Checklist
Screenshots/VideosWebreset-money-request-web.mp4Mobile Web - Chromereset-money-request-android-web-compressed.mp4Mobile Web - Safarireset-money-request-ios-web.mp4DesktopiOSreset-money-request-ios.mp4Androidreset-money-request-android-compressed.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.
Thanks guys, 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/marcochavezf in version: 1.3.75-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.75-12 🚀
|
🚀 Deployed to staging by https://github.com/marcochavezf in version: 1.3.76-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.76-6 🚀
|
Details
Fixed Issues
$ #26945
PROPOSAL: #26945 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Screen.Recording.2023-09-25.at.16.11.11.mp4
Mobile Web - Chrome
381755590_6378850562226056_4610030612457005125_n.mp4
Mobile Web - Safari
382657853_6072114082888795_6444920784609858618_n.mp4
Desktop
Screen.Recording.2023-09-25.at.16.25.45.mov
iOS
Uploading Screen Recording 2023-09-25 at 16.39.49.mov…
Android
Screen.Recording.2023-09-25.at.17.00.33.mov