Skip to content

Commit eb57213

Browse files
committed
refactor: remove empty useOnyx options objects
1 parent 2371069 commit eb57213

11 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/components/Attachments/AttachmentCarousel/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ function AttachmentCarousel({
2727
attachmentLink,
2828
onAttachmentError,
2929
}: AttachmentCarouselProps) {
30-
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`, {});
31-
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, {});
30+
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.parentReportID}`);
31+
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`);
3232
const canUseTouchScreen = canUseTouchScreenUtil();
3333
const styles = useThemeStyles();
3434
const isReportArchived = useReportIsArchived(report.reportID);

src/components/AvatarWithDisplayName.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function AvatarWithDisplayName({
187187
}: AvatarWithDisplayNameProps) {
188188
const {localeCompare, formatPhoneNumber} = useLocalize();
189189
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
190-
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`, {});
190+
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`);
191191
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST) ?? CONST.EMPTY_OBJECT;
192192
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
193193
const theme = useTheme();

src/components/MoneyRequestHeaderPrimaryAction.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ function MoneyRequestHeaderPrimaryAction({reportID}: MoneyRequestHeaderPrimaryAc
5656
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
5757
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`);
5858
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`);
59-
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`, {});
59+
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`);
6060
const parentReportAction = report?.parentReportActionID ? parentReportActions?.[report.parentReportActionID] : undefined;
6161
const transactionIDFromAction = isMoneyRequestAction(parentReportAction)
6262
? (getOriginalMessage(parentReportAction)?.IOUTransactionID ?? CONST.DEFAULT_NUMBER_ID)
6363
: CONST.DEFAULT_NUMBER_ID;
64-
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionIDFromAction}`, {});
64+
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionIDFromAction}`);
6565
const [transactionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(transaction?.reportID)}`);
6666
const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${getNonEmptyStringOnyxID(transactionReport?.policyID)}`);
6767
const [policyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${getNonEmptyStringOnyxID(transactionReport?.policyID)}`);

src/components/MoneyRequestHeaderSecondaryActions.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
115115
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
116116
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`);
117117
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`);
118-
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`, {});
118+
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.parentReportID}`);
119119
const parentReportAction = report?.parentReportActionID ? parentReportActions?.[report.parentReportActionID] : undefined;
120120
const transactionIDFromAction = isMoneyRequestAction(parentReportAction)
121121
? (getOriginalMessage(parentReportAction)?.IOUTransactionID ?? CONST.DEFAULT_NUMBER_ID)
122122
: CONST.DEFAULT_NUMBER_ID;
123-
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionIDFromAction}`, {});
123+
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionIDFromAction}`);
124124
const [originalTransaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transaction?.comment?.originalTransactionID)}`);
125125
const transactionViolations = useTransactionViolations(transaction?.transactionID);
126126

src/components/ReportActionItem/MoneyRequestReceiptView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function MoneyRequestReceiptView({
128128
const parentReportID = report?.parentReportID;
129129
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(parentReportID)}`);
130130
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(parentReport?.parentReportID)}`);
131-
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, {});
131+
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`);
132132
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
133133
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
134134
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});

src/components/ReportActionItem/MoneyRequestView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function MoneyRequestView({
190190
parentReport = parentReport ?? currentSearchResults?.data[`${ONYXKEYS.COLLECTION.REPORT}${parentReportID}`];
191191
const [parentReportNextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${getNonEmptyStringOnyxID(parentReport?.reportID)}`);
192192

193-
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, {});
193+
const [parentReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`);
194194
const parentReportAction = transactionThreadReport?.parentReportActionID ? parentReportActions?.[transactionThreadReport.parentReportActionID] : undefined;
195195

196196
const isFromMergeTransaction = !!mergeTransactionID;

src/hooks/useHoldRejectActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function useHoldRejectActions({reportID, onHoldEducationalOpen, onRejectModalOpe
3939
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(moneyRequestReport?.chatReportID)}`);
4040
const {transactionThreadReport} = useTransactionThreadReport(reportID);
4141

42-
const [reportActionsForParent] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(moneyRequestReport?.reportID)}`, {});
42+
const [reportActionsForParent] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(moneyRequestReport?.reportID)}`);
4343
const requestParentReportAction = transactionThreadReport?.parentReportActionID ? reportActionsForParent?.[transactionThreadReport.parentReportActionID] : undefined;
4444

4545
const {chatReport: chatIOUReport} = useGetIOUReportFromReportAction(requestParentReportAction);

src/pages/inbox/report/ReportActionCompose/ReportActionCompose.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function ReportActionComposeInner({reportID}: ReportActionComposeProps) {
9595
const isTransactionThreadView = isReportTransactionThread(report);
9696
const isExpensesReport = reportTransactions && reportTransactions.length > 1;
9797

98-
const [rawReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`, {});
98+
const [rawReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report?.reportID}`);
9999
const iouAction = rawReportActions ? (Object.values(rawReportActions).find((action) => isMoneyRequestAction(action)) as OnyxTypes.ReportAction | undefined) : undefined;
100100
const linkedTransactionID = iouAction && !isExpensesReport ? getLinkedTransactionID(iouAction) : undefined;
101101
const transactionID = getTransactionID(report) ?? linkedTransactionID;

src/pages/inbox/report/withReportAndReportActionOrNotFound.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function <TProps extends WithReportAndReportActionOrNotFoundProps
4545
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.route.params.reportID}`);
4646
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
4747
const [betas] = useOnyx(ONYXKEYS.BETAS);
48-
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`, {});
48+
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`);
4949
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
5050

5151
const parentReportAction = useParentReportAction(report);

src/pages/media/AttachmentModalScreen/routes/report/ReportAddAttachmentModalContent/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function ReportAddAttachmentModalContent({route, navigation}: AttachmentModalScr
3939
} = route.params;
4040

4141
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
42-
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {});
42+
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`);
4343
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`);
4444
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
4545
const [betas] = useOnyx(ONYXKEYS.BETAS);

0 commit comments

Comments
 (0)