-
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
[TS migration] Migrate 'MoneyRequestConfirmationList.js' component to TypeScript #34168
[TS migration] Migrate 'MoneyRequestConfirmationList.js' component to TypeScript #34168
Conversation
…s-migration/MoneyRequestConfirmationList/component
…s-migration/MoneyRequestConfirmationList/component
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
onPress={(_event, value) => confirm(value)} |
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.
// eslint-disable-next-line @typescript-eslint/naming-convention | |
onPress={(_event, value) => confirm(value)} | |
onPress={(event, value) => confirm(value)} |
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 this underscore was added for this marking this param as not used so not sure if this will change anything since I think we will still need disable eslint for that line
…s-migration/MoneyRequestConfirmationList/component
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
@@ -30,13 +30,13 @@ type ConfirmedRoutePropsOnyxProps = { | |||
|
|||
type ConfirmedRouteProps = ConfirmedRoutePropsOnyxProps & { | |||
/** Transaction that stores the distance request data */ | |||
transaction: Transaction; | |||
transaction: Transaction | undefined; |
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.
transaction: Transaction | undefined; | |
transaction?: Transaction; |
…s-migration/MoneyRequestConfirmationList/component
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
bankAccountRoute = '', | ||
policyID = '', | ||
reportID = '', | ||
receiptPath = '', | ||
receiptFilename = '', | ||
transactionID = '', |
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 possible let's remove empty strings as default value
…s-migration/MoneyRequestConfirmationList/component
@hoangzinh 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] |
…s-migration/MoneyRequestConfirmationList/component
? translate('common.tbd') | ||
: CurrencyUtils.convertToDisplayString( | ||
shouldCalculateDistanceAmount | ||
? DistanceRequestUtils.getDistanceRequestAmount(distance, mileageRate?.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, mileageRate?.rate ?? 0) |
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.
Could you explain why don't we set default value for mileageRate
like previous
mileageRate: {unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, rate: 0, currency: 'USD'}, |
Then we can just use mileageRate.unit
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.
Right, but when we default value in props for some reason typescript is not detecting that and for example type for mileageRate?.unit
is still Unit | undefined
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.
return; | ||
} | ||
|
||
const amount = DistanceRequestUtils.getDistanceRequestAmount(distance, mileageRate?.unit ?? CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES, mileageRate?.rate ?? 0); |
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.
Same question 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.
style={[styles.moneyRequestMenuItem, styles.mt2]} | ||
titleStyle={styles.moneyRequestConfirmationAmount} | ||
disabled={didConfirm} | ||
brickRoadIndicator={shouldDisplayFieldError && TransactionUtils.isAmountMissing(transaction ?? null) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} |
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.
The previous default value is an empty string, is it a mistake?
brickRoadIndicator={shouldDisplayFieldError && TransactionUtils.isAmountMissing(transaction) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} |
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.
}} | ||
disabled={didConfirm} | ||
interactive={!isReadOnly} | ||
brickRoadIndicator={shouldDisplayFieldError && TransactionUtils.isCreatedMissing(transaction ?? null) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} |
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.
Same here,
The previous default value is an empty string, is it a mistake?
brickRoadIndicator={shouldDisplayFieldError && TransactionUtils.isCreatedMissing(transaction) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : ''} |
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.
…s-migration/MoneyRequestConfirmationList/component
|
||
const receiptData = receiptPath && receiptFilename ? ReceiptUtils.getThumbnailAndImageURIs(transaction ?? null, receiptPath, receiptFilename) : null; | ||
return ( | ||
// @ts-expect-error TODO: Remove this once OptionsSelector (https://github.com/Expensify/App/issues/25125) is migrated to TypeScript. |
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.
Do we have a follow up issue for this?
…s-migration/MoneyRequestConfirmationList/component
@AndrewGable Yes we have, #25125 |
Thanks - FYI, There are now conflicts. |
…s-migration/MoneyRequestConfirmationList/component
@AndrewGable conflicts fixed 😄 |
…s-migration/MoneyRequestConfirmationList/component
…s-migration/MoneyRequestConfirmationList/component
@kubabutkiewicz heads up - lint is failing here |
…s-migration/MoneyRequestConfirmationList/component
@roryabraham thanks for a heads up, lint check is fixed now |
@hoangzinh - Do you mind running through the tests again once more? This is an important page to not break, so just want to make sure it's well tested before we merge it. |
@AndrewGable sure, I will try to test again today |
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 tested again. Looks good cc @AndrewGable
✋ 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/AndrewGable in version: 1.4.45-0 🚀
|
FYI this PR caused too many regressions and we are going to revert it. I'd be happy to review the next PR that addresses these issues. |
Will work on this tomorrow, sorry ! @AndrewGable |
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.45-6 🚀
|
Details
Fixed Issues
$ #25138
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 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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label 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.mp4
Android: mWeb Chrome
mchrome.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4