-
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
[No QA] [TS migration] Migrate 'TransactionUtils.js' lib to TypeScript #28005
[No QA] [TS migration] Migrate 'TransactionUtils.js' lib to TypeScript #28005
Conversation
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.
Left a couple comments.
# Conflicts: # src/libs/TransactionUtils.js # src/types/onyx/Transaction.ts
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.
Left a comment. Besides, LGTM.
@aimane-chnaif 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] |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24893 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
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, SWM still need to do the checklist.
}; | ||
} | ||
|
||
function hasReceipt(transaction: Transaction | undefined | null): 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.
function hasReceipt(transaction: Transaction | undefined | null): boolean { | |
function hasReceipt(transaction?: Transaction | null): 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.
@blazejkustra This way, it will be possible to call TransactionUtils.hasReceipt();
without any arguments, I am not sure that it's expected
Reviewing... |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromechrome.movMobile Web - Safarisafari.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
LGTM! Make sure to check suggestions from Błażej @VickyStash |
# Conflicts: # src/libs/TransactionUtils.js # src/types/onyx/OriginalMessage.ts # src/types/onyx/Transaction.ts
Congrats, that’s your 5th PR merged! 🎉 Do you know about the ContributorPlus role? It’s an opportunity to earn more in the Expensify Open Source community. Keep up the great work - thanks! |
✋ 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/cristipaval in version: 1.3.76-0 🚀
|
* Return the merchant field from the transaction, return the modifiedMerchant if present. | ||
*/ | ||
function getMerchant(transaction: Transaction): string { | ||
return transaction?.modifiedMerchant ?? transaction?.merchant ?? ''; |
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 caused a deploy blocker, the ??
operator only returns the right side of the operator if transaction?.modifiedMerchant
is null but the transaction?.modifiedMerchant
value in this case is `` an empty string so we return an empty string by mistake
* Return the created field from the transaction, return the modifiedCreated if present. | ||
*/ | ||
function getCreated(transaction: Transaction): string { | ||
const created = transaction?.modifiedCreated ?? transaction?.created ?? ''; |
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 caused a deploy blocker, the ??
operator only returns the right side of the operator if transaction?. modifiedCreated
is null but the transaction?. modifiedCreated
value in this case is `` an empty string so we return an empty string by mistake
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.76-6 🚀
|
🚀 Deployed to staging by https://github.com/cristipaval in version: 1.3.77-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.77-7 🚀
|
* Filters the waypoints which are valid and returns those | ||
*/ | ||
function getValidWaypoints(waypoints: WaypointCollection, reArrangeIndexes = false): WaypointCollection { | ||
const sortedIndexes = Object.keys(waypoints).map(getWaypointIndex).sort(); |
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.
@VickyStash I think this introduced a regression or is at least part of the cause for this issue #29621.
By default Array.prototype.sort() does the following. "The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values.". So therefore the waypoints get out of order when you have 10+ because the number indexes are sorted as strings.
I'm working on a fix, which should be easy for this piece.
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.
cc @cristipaval since you reviewed as well
Details
Migrate 'TransactionUtils.js' lib to TypeScript
Fixed Issues
$ #24893
PROPOSAL: N/A
Tests
Make sure the Request Money functionality works as expected
Offline tests
QA Steps
Make sure the Request Money functionality works as expected
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
Web.mov
Mobile Web - Chrome
android.google.mp4
Mobile Web - Safari
ios.safari.mp4
Desktop
Desktop.mov
iOS
ios.mov
Android
Android.mov