-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: Expense details - Violation is not displayed on description field when opening IOU details. #56405
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
fix: Expense details - Violation is not displayed on description field when opening IOU details. #56405
Changes from all commits
1e084f2
fafe6d4
3c2ab26
1143243
fc381b2
acb2a64
6913635
083bf1e
17fcb63
b7dc805
6000897
b99c0d9
61e467f
c57af96
483790c
7aceaae
e835fbc
303726f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
| import {reportTransactionsSelector} from '@libs/ReportUtils'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {Report, Transaction, TransactionViolation} from '@src/types/onyx'; | ||
|
|
||
| function useReportWithTransactionsAndViolations(reportID?: string): [OnyxEntry<Report>, Transaction[], OnyxCollection<TransactionViolation[]>] { | ||
| const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID ?? CONST.DEFAULT_NUMBER_ID}`); | ||
| const [transactions = []] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION, { | ||
| selector: (_transactions) => reportTransactionsSelector(_transactions, reportID), | ||
| }); | ||
| const [violations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, { | ||
|
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. This was causing the the submit button to be shown briefly before the review button so we added |
||
| selector: (allViolations) => | ||
| Object.fromEntries( | ||
| Object.entries(allViolations ?? {}).filter(([key]) => | ||
| transactions.some((transaction) => transaction.transactionID === key.replace(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, '')), | ||
|
Member
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. This PR caused #63155 (comment) |
||
| ), | ||
| ), | ||
| }); | ||
| return [report, transactions, violations]; | ||
| } | ||
|
|
||
| export default useReportWithTransactionsAndViolations; | ||
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.
Why didn't we pass transaction?.transactionID?