Repository navigation
Fix: Order of distance rates on confirm page changes after reset app #71529
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5302de7
Fix: Order of distance rates on confirm page changes after reset app
nyomanjyotisa 6fcb840
Merge branch 'main' into issue-70194
nyomanjyotisa 4a9e5ad
Fix: Replace deprecated localeCompare in DistanceRequestUtils
nyomanjyotisa 23ea793
Fix: Order of distance rates on confirm page changes after reset app
nyomanjyotisa 8e4155e
Merge branch 'main' into issue-70194
nyomanjyotisa 76a8f31
Add missing localeCompare dependencies
nyomanjyotisa b2ca955
Merge branch 'main' into issue-70194
nyomanjyotisa c302e78
Merge branch 'main' into issue-70194
nyomanjyotisa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,7 +73,7 @@ function IOURequestStepParticipants({ | |
| transaction: initialTransaction, | ||
| }: IOURequestStepParticipantsProps) { | ||
| const participants = initialTransaction?.participants; | ||
| const {translate} = useLocalize(); | ||
| const {translate, localeCompare} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const isFocused = useIsFocused(); | ||
| const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${initialTransactionID}`, {canBeMissing: true}); | ||
|
|
@@ -232,7 +232,7 @@ function IOURequestStepParticipants({ | |
| if (!isMovingTransactionFromTrackExpense) { | ||
| // If not moving the transaction from track expense, select the default rate automatically. | ||
| // Otherwise, keep the original p2p rate and let the user manually change it to the one they want from the workspace. | ||
| const rateID = DistanceRequestUtils.getCustomUnitRateID({reportID: firstParticipantReportID, isPolicyExpenseChat, policy, lastSelectedDistanceRates}); | ||
| const rateID = DistanceRequestUtils.getCustomUnitRateID({reportID: firstParticipantReportID, isPolicyExpenseChat, policy, lastSelectedDistanceRates, localeCompare}); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add localeCompare in useCallback dependecy array?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good catch |
||
|
|
||
| if (transactions.length > 0) { | ||
| transactions.forEach((transaction) => { | ||
|
|
@@ -268,7 +268,19 @@ function IOURequestStepParticipants({ | |
| shouldAutoReport.current = !!policy?.autoReporting || !!personalPolicy?.autoReporting; | ||
| } | ||
| }, | ||
| [action, iouType, transactions, isMovingTransactionFromTrackExpense, reportID, trackExpense, allPolicies, personalPolicy, lastSelectedDistanceRates, initialTransactionID], | ||
| [ | ||
| action, | ||
| iouType, | ||
| transactions, | ||
| isMovingTransactionFromTrackExpense, | ||
| reportID, | ||
| trackExpense, | ||
| allPolicies, | ||
| personalPolicy, | ||
| lastSelectedDistanceRates, | ||
| initialTransactionID, | ||
| localeCompare, | ||
| ], | ||
| ); | ||
|
|
||
| const goToNextStep = useCallback(() => { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we make
localeComparerequired instead of optional? That should avoid anyone forgetting the param.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.
@arosiclair As mentioned earlier,
getDefaultMileageRateis also used by other internal functions, such asgetRateandgetRateByCustomUnitRateID. MakinglocaleComparea required parameter would likely require significant changes to propagate it through all the places where these functions are usedFor example,
getRateis called in thegetMerchantfunction inTransactionUtils. If the accepted approach is to getlocaleComparefrom theuseLocalizehook and passlocaleCompareas a parameter, I think it would require big changesThere are also
getUpdatedTransaction,isUnreportedAndHasInvalidDistanceRateTransaction, andbuildOptimisticTransactionwhich callgetRateandgetUpdatedDistanceUnitinTransactionUtilsThere 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.
Alright fair enough 👌