-
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
Preserve transactions amount in create IOU #40062
Preserve transactions amount in create IOU #40062
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] |
@dangrous I kept the amount check here and it fixed the zero issue:
Result: Screen.Recording.2024-04-11.at.4.16.25.AM.mov |
@eVoloshchak can you give this a look? Looks like we've got some new merge conflicts too, @abzokhattab |
…t-in-the-amount-formm
Resolved the conflicts .. please let me know if you have any other comments |
I'm too late again, apologies @abzokhattab, could you resolve the conflicts again? |
oh, okay resolved them :D @eVoloshchak |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-04-19.at.00.04.02.movAndroid: mWeb ChromeScreen.Recording.2024-04-19.at.00.00.34.moviOS: NativeScreen.Recording.2024-04-19.at.00.04.45.moviOS: mWeb SafariScreen.Recording.2024-04-19.at.00.02.28.movMacOS: Chrome / SafariScreen.Recording.2024-04-18.at.23.58.34.movMacOS: DesktopScreen.Recording.2024-04-18.at.23.59.25.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.
Tests well!
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.
Just one question - and now some merge conflicts - then i think we're good.
To note, too - our preserving of user input means that if a user enters 123.2
initially and then goes to the next screen and back, it's still 123.2
which is a little wonky? But as we discussed, we DO want that for 123
(no decimal) so I think it's probably fine. Just wanted to bring it up in case we wanted to discuss.
@@ -93,7 +97,7 @@ function MoneyRequestAmountForm( | |||
const isTaxAmountForm = Navigation.getActiveRoute().includes('taxAmount'); | |||
|
|||
const decimals = CurrencyUtils.getCurrencyDecimals(currency); | |||
const selectedAmountAsString = amount ? CurrencyUtils.convertToFrontendAmount(amount).toString() : ''; | |||
const selectedAmountAsString = amount ? CurrencyUtils.convertToFrontendAmountAsString(amount) : ''; |
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.
Won't this just return ''
if we let the null amount
go through?
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 but if the amount is zero the convertToFrontendAmountAsString
will return 0.00
which is not wanted.. so i kept that check to return ""
in this specific case
that would pass .. if the user enters Screen.Recording.2024-04-23.at.6.58.19.AM.movcc @eVoloshchak |
conflicts are now resolved |
@abzokhattab @dangrous @eVoloshchak , I still think that my fix from the issue: const initializeAmount = useCallback((newAmount) => {
const frontendAmount = newAmount ?
(newAmount.includes('.') ? parseFloat(CurrencyUtils.convertToFrontendAmount(newAmount)).toFixed(2) : CurrencyUtils.convertToFrontendAmount(newAmount))
: ''; Is a lot simpler fix for this issue, @abzokhattab can you test this one please, we need not be making such vast changes, this can possibly be dealt on the |
more merge conflicts unfortunately - @eVoloshchak let us know when you can take a look, and if we can potentially simplify re: @GandalfGwaihir 's thought above (I haven't investigated yet). Thank you! |
@GandalfGwaihir, I cannot test this due to the above, but looking at the code it seems it doesn't implement the behavior described in #34894 (comment)
Is that correct? |
Bump on this thanks! |
@@ -144,7 +148,7 @@ function MoneyRequestAmountForm( | |||
}, [isFocused, wasFocused]); | |||
|
|||
const initializeAmount = useCallback((newAmount: number) => { | |||
const frontendAmount = newAmount ? CurrencyUtils.convertToFrontendAmount(newAmount).toString() : ''; | |||
const frontendAmount = newAmount ? CurrencyUtils.convertToFrontendAmountAsString(newAmount).toString() : ''; |
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.
const frontendAmount = newAmount ? CurrencyUtils.convertToFrontendAmountAsString(newAmount).toString() : ''; | |
const frontendAmount = CurrencyUtils.convertToFrontendAmountAsString(newAmount); |
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.
this suggestion will cause this issue again
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.
Isn't this already handled in convertToFrontendAmountAsString
?
if (amountAsInt === null || amountAsInt === undefined) {
return '';
}
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.
Not the same:
newAmount ?
the question mark here checks if the value is null
, undefined
and not 0
so in case the value is 0
it goes to the else condition which returns an empty string ""
let us know if you have any questions on @eVoloshchak suggestions, @abzokhattab! |
sorry I missed the notification. here is the lastest test: Screen.Recording.2024-05-19.at.7.05.31.PM.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.
Re-tested, looking good
@abzokhattab, could you take a look at #40062 (comment) please? |
…amount-in-the-amount-formm
I added another test to ensure that the input is not prefilled with I think the PR is ready now |
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.
Looks good! Holding on the merge for now, though.
In the meantime - do you mind updating the tests one more time? Sorry. Since we wrote them, we changed the design of the app so there's no longer a "Request money" option, it's "Submit expense" or "track expense". And the FAB is no longer F
loating, though maybe we still call it that?
Anyways, thanks for your work - and patience - on this!
Merge freeze is off so I think we're good to push this through once the tests are updated as noted above! (To be in line with new UI) |
done .. just update the test 🎉 |
Great! But now conflicts 😂 |
…amount-in-the-amount-formm
Lol, this loop never ends 😂 Done .. maybe the last time .. maybe |
@abzokhattab, please add one more test from #34894
|
@eVoloshchak done |
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.
kk, let's go for it!
✋ 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/luacmartins in version: 1.4.81-11 🚀
|
Details
Fixed Issues
$ #34894
$ #34894 (comment)
Tests
In the meantime - do you mind updating the tests one more time? Sorry. Since we wrote them, we changed the design of the app so there's no longer a "Request money" option, it's "Submit expense" or "track expense". And the FAB is no longer Floating, though maybe we still call it that?
Test 1:
0.00
Test2:
Test3:
Offline tests
Same as in tests
QA Steps
same as in tests
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
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
Android: Native
Screen.Recording.2024-02-02.at.2.15.48.AM.mov
Android: mWeb Chrome
Screen.Recording.2024-02-05.at.10.21.39.AM.mov
iOS: Native
Screen.Recording.2024-02-02.at.2.15.48.AM.mov
iOS: mWeb Safari
Screen.Recording.2024-02-05.at.10.21.39.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-02-05.at.10.20.36.AM.mov
MacOS: Desktop
Screen.Recording.2024-02-05.at.10.20.59.AM.mov