Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {MoneyRequestNavigatorParamList} from '@libs/Navigation/types';
import {getActivePoliciesWithExpenseChatAndPerDiemEnabled, getPerDiemCustomUnit} from '@libs/PolicyUtils';
import {getPolicyExpenseChat} from '@libs/ReportUtils';
import {setCustomUnitID, setMoneyRequestCategory, setMoneyRequestParticipants} from '@userActions/IOU';
import {setTransactionReport} from '@userActions/Transaction';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
Expand All @@ -30,6 +31,7 @@ function IOURequestStepPerDiemWorkspace({route, navigation}: IOURequestStepPerDi
return;
}
const perDiemUnit = getPerDiemCustomUnit(policy);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ CONSISTENCY-3 (docs)

The isDraft parameter is hardcoded to true, but similar code in IOURequestStepTimeWorkspace.tsx uses shouldUseTransactionDraft(action) to determine whether to use draft mode or not. This inconsistency violates the DRY principle and may cause bugs when the action is not a draft action.

Suggested fix:

import {shouldUseTransactionDraft} from '@libs/IOUUtils';

// Inside the component:
const isTransactionDraft = shouldUseTransactionDraft(action);

// In the onSelectWorkspace callback:
setTransactionReport(transactionID, {reportID: policyExpenseReportID}, isTransactionDraft);

This matches the pattern used in IOURequestStepTimeWorkspace.tsx (line 23 and line 37).


Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

setTransactionReport(transactionID, {reportID: policyExpenseReportID}, true);
setMoneyRequestParticipants(transactionID, [
{
selected: true,
Expand Down
Loading