-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix: Duplicate review tax code page shows no options across workspaces #81079
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
Open
MobileMage
wants to merge
1
commit into
Expensify:main
Choose a base branch
from
MobileMage:fix/80476-review-tax-code-report-id
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+13
−5
Open
Changes from all commits
Commits
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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ import Navigation from '@libs/Navigation/Navigation'; | |
| import {getOriginalMessage, isMoneyRequestAction as isMoneyRequestActionReportActionsUtils} from '@libs/ReportActionsUtils'; | ||
| import {getTransactionDetails} from '@libs/ReportUtils'; | ||
| import {getReviewNavigationRoute} from '@libs/TransactionPreviewUtils'; | ||
| import {getExpenseTypeTranslationKey, getOriginalTransactionWithSplitInfo, getTransactionType, removeSettledAndApprovedTransactions} from '@libs/TransactionUtils'; | ||
| import {getExpenseTypeTranslationKey, getOriginalTransactionWithSplitInfo, getTransactionID, getTransactionType, removeSettledAndApprovedTransactions} from '@libs/TransactionUtils'; | ||
| import type {PlatformStackRouteProp} from '@navigation/PlatformStackNavigation/types'; | ||
| import type {TransactionDuplicateNavigatorParamList} from '@navigation/types'; | ||
| import {clearWalletTermsError} from '@userActions/PaymentMethods'; | ||
|
|
@@ -59,6 +59,13 @@ function TransactionPreview(props: TransactionPreviewProps) { | |
| const chatReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`]; | ||
| const personalDetails = usePersonalDetails(); | ||
|
|
||
| // Load thread transaction's complete duplicate list for cross-workspace comparison | ||
| const threadReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${route.params?.threadReportID}`]; | ||
| const threadViolations = useTransactionViolations(getTransactionID(threadReport)); | ||
| const [threadDuplicates] = useTransactionsByID( | ||
| useMemo(() => threadViolations?.find((v) => v.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION)?.data?.duplicates ?? [], [threadViolations]), | ||
|
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. I think this file is compiled with react-compiler, we might not need the useMemo here. |
||
| ); | ||
|
|
||
| // Get transaction violations for given transaction id from onyx, find duplicated transactions violations and get duplicates | ||
| const allDuplicateIDs = useMemo(() => violations?.find((violation) => violation.name === CONST.VIOLATIONS.DUPLICATED_TRANSACTION)?.data?.duplicates ?? [], [violations]); | ||
| const [allDuplicates] = useTransactionsByID(allDuplicateIDs); | ||
|
|
@@ -82,8 +89,9 @@ function TransactionPreview(props: TransactionPreviewProps) { | |
| }, [chatReportID]); | ||
|
|
||
| const navigateToReviewFields = useCallback(() => { | ||
| Navigation.navigate(getReviewNavigationRoute(Navigation.getActiveRoute(), route.params?.threadReportID, transaction, duplicates, policyCategories, transactionReport)); | ||
| }, [route.params?.threadReportID, transaction, duplicates, policyCategories, transactionReport]); | ||
| const allDuplicateTransactions = [...duplicates, ...(threadDuplicates ?? [])]; | ||
| Navigation.navigate(getReviewNavigationRoute(Navigation.getActiveRoute(), route.params?.threadReportID, transaction, allDuplicateTransactions, policyCategories, transactionReport)); | ||
| }, [route.params?.threadReportID, transaction, duplicates, threadDuplicates, policyCategories, transactionReport]); | ||
|
|
||
| const transactionPreview = transaction; | ||
|
|
||
|
|
||
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,8 +24,7 @@ function ReviewTaxRate() { | |||||
| const route = useRoute<PlatformStackRouteProp<TransactionDuplicateNavigatorParamList, typeof SCREENS.TRANSACTION_DUPLICATE.TAX_CODE>>(); | ||||||
| const {translate} = useLocalize(); | ||||||
| const [reviewDuplicates] = useOnyx(ONYXKEYS.REVIEW_DUPLICATES, {canBeMissing: true}); | ||||||
| const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reviewDuplicates?.reportID ?? route.params.threadReportID}`, {canBeMissing: true}); | ||||||
| const policy = usePolicy(report?.policyID); | ||||||
| const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${route.params.threadReportID}`, {canBeMissing: true}); | ||||||
|
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.
Suggested change
|
||||||
| const transactionID = getTransactionID(report); | ||||||
| const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionID)}`, {canBeMissing: true}); | ||||||
| const [transactionViolations] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, { | ||||||
|
|
@@ -38,6 +37,7 @@ function ReviewTaxRate() { | |||||
| const [allDuplicates] = useTransactionsByID(allDuplicateIDs); | ||||||
| const [reviewDuplicatesReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(reviewDuplicates?.reportID)}`, {canBeMissing: true}); | ||||||
| const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${getNonEmptyStringOnyxID(reviewDuplicatesReport?.policyID)}`, {canBeMissing: true}); | ||||||
| const policy = usePolicy(reviewDuplicatesReport?.policyID); | ||||||
|
|
||||||
| const compareResult = compareDuplicateTransactionFields(transaction, allDuplicates, reviewDuplicatesReport, undefined, policyCategories); | ||||||
| const stepNames = Object.keys(compareResult.change ?? {}).map((key, index) => (index + 1).toString()); | ||||||
|
|
||||||
Oops, something went wrong.
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.