Skip to content

Commit 9f35346

Browse files
committed
avoid userBillingFundID prop drilling
1 parent 5c7bfff commit 9f35346

15 files changed

Lines changed: 4 additions & 53 deletions

src/components/MoneyRequestReportView/MoneyRequestReportActionsList.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ function MoneyRequestReportActionsList({onLayout}: MoneyRequestReportListProps)
126126

127127
const parentReportAction = useParentReportAction(report);
128128

129-
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
130129
const personalDetails = usePersonalDetails();
131130
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
132131
const isTryNewDotNVPDismissed = !!tryNewDot?.classicRedirect?.dismissed;
@@ -579,7 +578,6 @@ function MoneyRequestReportActionsList({onLayout}: MoneyRequestReportListProps)
579578
shouldHideThreadDividerLine
580579
linkedReportActionID={linkedReportActionID}
581580
personalDetails={personalDetails}
582-
userBillingFundID={userBillingFundID}
583581
originalReportID={originalReportID}
584582
isReportArchived={isReportArchived}
585583
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
@@ -599,7 +597,6 @@ function MoneyRequestReportActionsList({onLayout}: MoneyRequestReportListProps)
599597
firstVisibleReportActionID,
600598
linkedReportActionID,
601599
personalDetails,
602-
userBillingFundID,
603600
isTryNewDotNVPDismissed,
604601
isReportArchived,
605602
reportNameValuePairs?.origin,

src/components/Search/SearchList/ListItem/ChatListItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function ChatListItem<TItem extends ListItem>({
2626
onLongPressRow,
2727
shouldSyncFocus,
2828
personalDetails,
29-
userBillingFundID,
3029
}: ChatListItemProps<TItem>) {
3130
const reportActionItem = item as unknown as ReportActionListItemType;
3231
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportActionItem?.reportID}`);
@@ -86,7 +85,6 @@ function ChatListItem<TItem extends ListItem>({
8685
shouldShowDraftMessage={false}
8786
shouldShowBorder
8887
personalDetails={personalDetails}
89-
userBillingFundID={userBillingFundID}
9088
/>
9189
</BaseListItem>
9290
);

src/components/Search/SearchList/ListItem/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ type ChatListItemProps<TItem extends ListItem> = ListItemProps<TItem> & {
5353

5454
/** Personal details list */
5555
personalDetails: OnyxEntry<PersonalDetailsList>;
56-
57-
/** User billing fund ID */
58-
userBillingFundID: number | undefined;
5956
};
6057

6158
type ExpenseReportListItemProps<TItem extends ListItem> = ListItemProps<TItem> &

src/components/Search/SearchList/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ function SearchList({
302302
const hasItemsBeingRemoved = prevDataLength && prevDataLength > data.length;
303303
const personalDetails = usePersonalDetails();
304304

305-
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
306305
const [lastPaymentMethod] = useOnyx(ONYXKEYS.NVP_LAST_PAYMENT_METHOD);
307306
const [personalPolicyID] = useOnyx(ONYXKEYS.PERSONAL_POLICY_ID);
308307
const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
@@ -453,7 +452,6 @@ function SearchList({
453452
userBillingGracePeriodEnds={userBillingGracePeriodEnds}
454453
ownerBillingGracePeriodEnd={ownerBillingGracePeriodEnd}
455454
personalDetails={personalDetails}
456-
userBillingFundID={userBillingFundID}
457455
isOffline={isOffline}
458456
violations={violations}
459457
nonPersonalAndWorkspaceCards={nonPersonalAndWorkspaceCards}
@@ -483,7 +481,6 @@ function SearchList({
483481
canSelectMultiple,
484482
columns,
485483
personalDetails,
486-
userBillingFundID,
487484
isOffline,
488485
violations,
489486
lastPaymentMethod,

src/pages/Debug/ReportAction/DebugReportActionCreatePage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function DebugReportActionCreatePage({
4949
const [session] = useOnyx(ONYXKEYS.SESSION);
5050
const [personalDetailsList] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
5151
const [draftReportAction, setDraftReportAction] = useState<string>(() => getInitialReportAction(reportID, session, personalDetailsList));
52-
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
5352
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
5453
const isTryNewDotNVPDismissed = !!tryNewDot?.classicRedirect?.dismissed;
5554

@@ -119,7 +118,6 @@ function DebugReportActionCreatePage({
119118
isFirstVisibleReportAction={false}
120119
shouldDisplayContextMenu={false}
121120
personalDetails={personalDetailsList}
122-
userBillingFundID={userBillingFundID}
123121
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
124122
/>
125123
) : (

src/pages/Debug/ReportAction/DebugReportActionPreview.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type DebugReportActionPreviewProps = {
1717

1818
function DebugReportActionPreview({reportAction, reportID}: DebugReportActionPreviewProps) {
1919
const personalDetails = usePersonalDetails();
20-
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
2120
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
2221
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
2322
const isTryNewDotNVPDismissed = !!tryNewDot?.classicRedirect?.dismissed;
@@ -34,7 +33,6 @@ function DebugReportActionPreview({reportAction, reportID}: DebugReportActionPre
3433
isFirstVisibleReportAction={false}
3534
shouldDisplayContextMenu={false}
3635
personalDetails={personalDetails}
37-
userBillingFundID={userBillingFundID}
3836
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
3937
/>
4038
</ScrollView>

src/pages/TransactionDuplicate/DuplicateTransactionItem.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ function DuplicateTransactionItem({transaction, index, onPreviewPressed}: Duplic
2525
const styles = useThemeStyles();
2626
const personalDetails = usePersonalDetails();
2727

28-
const [userBillingFundID] = useOnyx(ONYXKEYS.NVP_BILLING_FUND_ID);
2928
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transaction?.reportID}`);
3029
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`);
3130
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
@@ -73,7 +72,6 @@ function DuplicateTransactionItem({transaction, index, onPreviewPressed}: Duplic
7372
personalDetails={personalDetails}
7473
draftMessage={matchingDraftMessage}
7574
linkedTransactionRouteError={linkedTransactionRouteError}
76-
userBillingFundID={userBillingFundID}
7775
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
7876
/>
7977
</ReportActionItemActionsContext.Provider>

src/pages/inbox/report/PureReportActionItem.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ type PureReportActionItemProps = {
159159
/** Whether the provided report is a closed expense report with no expenses */
160160
isClosedExpenseReportWithNoExpenses?: boolean;
161161

162-
/** User payment card ID */
163-
userBillingFundID?: number;
164-
165162
/** Whether to show border for MoneyRequestReportPreviewContent */
166163
shouldShowBorder?: boolean;
167164

@@ -202,7 +199,6 @@ function PureReportActionItem({
202199
originalReport,
203200
isArchivedRoom,
204201
isClosedExpenseReportWithNoExpenses,
205-
userBillingFundID,
206202
shouldShowBorder,
207203
shouldHighlight = false,
208204
isTryNewDotNVPDismissed = false,
@@ -627,7 +623,6 @@ function PureReportActionItem({
627623
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
628624
shouldShowBorder={shouldShowBorder}
629625
isOnSearch={isOnSearch}
630-
userBillingFundID={userBillingFundID}
631626
index={index}
632627
setIsPaymentMethodPopoverActive={setIsPaymentMethodPopoverActive}
633628
/>
@@ -715,7 +710,6 @@ export default memo(PureReportActionItem, (prevProps, nextProps) => {
715710
deepEqual(prevProps.originalReport?.participants, nextProps.originalReport?.participants) &&
716711
prevProps.isArchivedRoom === nextProps.isArchivedRoom &&
717712
prevProps.isClosedExpenseReportWithNoExpenses === nextProps.isClosedExpenseReportWithNoExpenses &&
718-
prevProps.userBillingFundID === nextProps.userBillingFundID &&
719713
prevProps.shouldHighlight === nextProps.shouldHighlight &&
720714
prevProps.reportNameValuePairsOrigin === nextProps.reportNameValuePairsOrigin &&
721715
prevProps.reportNameValuePairsOriginalID === nextProps.reportNameValuePairsOriginalID

src/pages/inbox/report/ReportActionItem.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ type ReportActionItemProps = PureReportActionItemProps & {
2121
/** Personal details list */
2222
personalDetails: OnyxEntry<PersonalDetailsList>;
2323

24-
/** User billing fund ID */
25-
userBillingFundID: number | undefined;
26-
2724
/** Did the user dismiss trying out NewDot? If true, it means they prefer using OldDot */
2825
isTryNewDotNVPDismissed?: boolean;
2926
};
@@ -33,7 +30,6 @@ function ReportActionItem({
3330
report,
3431
draftMessage,
3532
personalDetails,
36-
userBillingFundID,
3733
linkedTransactionRouteError: linkedTransactionRouteErrorProp,
3834
isTryNewDotNVPDismissed,
3935
...props
@@ -70,7 +66,6 @@ function ReportActionItem({
7066
originalReport={originalReport}
7167
isArchivedRoom={isArchivedNonExpenseReport(originalReport, isOriginalReportArchived)}
7268
isClosedExpenseReportWithNoExpenses={isClosedExpenseReportWithNoExpenses(iouReport, transactionsOnIOUReport)}
73-
userBillingFundID={userBillingFundID}
7469
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
7570
/>
7671
);

src/pages/inbox/report/ReportActionItemParentAction.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ type ReportActionItemParentActionProps = {
6363
/** Personal details list */
6464
personalDetails: OnyxEntry<PersonalDetailsList>;
6565

66-
/** User billing fund ID */
67-
userBillingFundID: number | undefined;
68-
6966
/** Did the user dismiss trying out NewDot? If true, it means they prefer using OldDot */
7067
isTryNewDotNVPDismissed: boolean | undefined;
7168

@@ -84,7 +81,6 @@ function ReportActionItemParentAction({
8481
isFirstVisibleReportAction = false,
8582
shouldUseThreadDividerLine = false,
8683
personalDetails,
87-
userBillingFundID,
8884
isTryNewDotNVPDismissed = false,
8985
isReportArchived = false,
9086
}: ReportActionItemParentActionProps) {
@@ -229,7 +225,6 @@ function ReportActionItemParentAction({
229225
personalDetails={personalDetails}
230226
draftMessage={matchingDraftMessageString}
231227
linkedTransactionRouteError={linkedTransactionRouteError}
232-
userBillingFundID={userBillingFundID}
233228
isTryNewDotNVPDismissed={isTryNewDotNVPDismissed}
234229
/>
235230
</OfflineWithFeedback>

0 commit comments

Comments
 (0)