-
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
Reset amount on reset button click #42897
Reset amount on reset button click #42897
Conversation
@eVoloshchak 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] |
@eVoloshchak PR ready |
@@ -82,6 +82,9 @@ type MoneyRequestAmountInputProps = { | |||
* Autogrow input container length based on the entered text. | |||
*/ | |||
autoGrow?: boolean; | |||
|
|||
/** Flag indicating if the reset button was clicked to reset the amount */ | |||
resetClicked?: boolean; |
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 think we should improve the naming to be more self-explanatory
Perhaps shouldResetAmount
would work?
@@ -135,6 +139,7 @@ function MoneyRequestAmountInput( | |||
}); | |||
|
|||
const forwardDeletePressedRef = useRef(false); | |||
const resetFlag = useRef(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.
Let's call this the same as the new prop (resetClicked/shouldResetAmount/or whichever it ends up being called)
@kaushiktd, also please
|
@eVoloshchak PR ready. Please check. |
Reviewer Checklist
Screenshots/VideosAndroid: Native24-07-02-12-26-37.mp4Android: mWeb ChromeScreen.Recording.2024-07-02.at.12.08.29.moviOS: NativeScreen.Recording.2024-07-01.at.19.56.50.moviOS: mWeb SafariScreen.Recording.2024-07-01.at.22.27.35.movMacOS: Chrome / SafariScreen.Recording.2024-07-01.at.19.51.48.movMacOS: DesktopScreen.Recording.2024-07-02.at.12.11.18.mov |
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.
@kaushiktd, the behavior on native platforms and mWeb is different: on mWeb the keyboard is dismissed after you press 'reset', while on native it stays open.
According to #41763 (comment), the desired behavior is for the keyboard to stay open
iOS.native.mov
mWeb.Safari.mov
@eVoloshchak |
Friendly bump @eVoloshchak |
@eVoloshchak any update? |
Apologies for the delay @kaushiktd
I do agree with this, the issue description specifically mentions native platforms. Let's fix it here and then decide if the same is worth doing for mWeb |
@eVoloshchak if I'm understanding it correctly, you are asking me to do the PR again, right? Not requesting mWeb. |
Friendly bump @eVoloshchak |
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!
@kaushiktd, could you please add the following last step to Test steps:
Verify the split amount is reset
Making a build to test this out |
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
@eVoloshchak @youssef-lr friendly bump on this for an update |
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
Can we fix conflicts please? |
I think this looks good from a design standpoint too. |
From the recordings though, it looks like on iOS, hitting reset keeps you focused in the same input you were editing. But on desktop, hitting Reset makes you lose focus on the input you were editing. Is that on purpose? |
@shawnborton this is the default behaviour of desktop as well as web |
Sounds good, thanks for confirming!
…On Wed, Jul 10, 2024 at 10:57 AM Kaushik Kapadiya ***@***.***> wrote:
@shawnborton <https://github.com/shawnborton> this is the default
behaviour of desktop as well as web
—
Reply to this email directly, view it on GitHub
<#42897 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARWH5SP24YIX5VBNC2XA6DZLTZOTAVCNFSM6AAAAABISILTJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJZHE2DIMJUHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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. |
|
||
// we want to re-initialize the state only when the amount changes | ||
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps | ||
}, [amount, shouldKeepUserInput]); | ||
}, [amount, currency, formatAmountOnBlur, shouldKeepUserInput, onFormatAmount, shouldResetAmount, onResetAmount, currentAmount]); |
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.
Hey 👋 It looks like this change introduced a bug (check the revert PR description)
cc @mountiny
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 tried to bring those lines back
// we want to re-initialize the state only when the amount changes
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [amount, shouldKeepUserInput]);
and the input is working again, so a fix should be pretty easy :)
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.
Heads up we ended up reverting this PR because of the above mentioned critical issue.
We opted for a revert to make sure there are no other unwanted regressions
@kaushiktd can you raise a new PR and make sure to test for the input working well
🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.0.7-3 🚀
|
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 9.0.7-4 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.7-8 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.8-6 🚀
|
Details
Fixed Issues
$ #41763
PROPOSAL: #41763 (comment)
Tests
Offline tests
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 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.webm
Android: mWeb Chrome
androidweb.webm
iOS: Native
ios.webm
iOS: mWeb Safari
iosweb.webm
MacOS: Chrome / Safari
web.webm
MacOS: Desktop
Desktop.webm