Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
7 changes: 0 additions & 7 deletions config/eslint/eslint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,13 @@
"../../src/components/Modal/ReanimatedModal/Container/index.web.tsx" "react-hooks/refs" 1
"../../src/components/Modal/ReanimatedModal/index.tsx" "@typescript-eslint/no-deprecated/InteractionManager.clearInteractionHandle" 1
"../../src/components/Modal/ReanimatedModal/index.tsx" "@typescript-eslint/no-deprecated/InteractionManager.createInteractionHandle" 1
"../../src/components/MoneyReportHeaderActions/MoneyReportHeaderSecondaryActions.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/MoneyReportHeaderActions/MoneyReportHeaderSelectionDropdown.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/MoneyReportHeaderActions/index.tsx" "@typescript-eslint/no-unsafe-type-assertion" 2
"../../src/components/MoneyReportHeaderPrimaryAction/ApprovePrimaryAction.tsx" "no-restricted-imports" 1
"../../src/components/MoneyReportHeaderPrimaryAction/ExportPrimaryAction.tsx" "no-restricted-imports" 1
"../../src/components/MoneyReportHeaderPrimaryAction/MarkAsCashPrimaryAction.tsx" "no-restricted-imports" 1
"../../src/components/MoneyReportHeaderPrimaryAction/MarkAsResolvedPrimaryAction.tsx" "no-restricted-imports" 1
"../../src/components/MoneyReportHeaderPrimaryAction/RemoveHoldPrimaryAction.tsx" "no-restricted-imports" 1
"../../src/components/MoneyReportHeaderPrimaryAction/ReviewDuplicatesPrimaryAction.tsx" "no-restricted-imports" 1
"../../src/components/MoneyReportHeaderPrimaryAction/SubmitPrimaryAction.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/MoneyRequestAmountInput.tsx" "react-hooks/immutability" 2
"../../src/components/MoneyRequestConfirmationList.tsx" "react-hooks/set-state-in-effect" 2
"../../src/components/MoneyRequestConfirmationList/ConfirmationFooterContent.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
Expand Down Expand Up @@ -356,7 +353,6 @@
"../../src/components/ReportActionItem/MoneyRequestReportPreview/ApproveActionButton.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/ReportActionItem/MoneyRequestReportPreview/PayActionButton.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/ReportActionItem/MoneyRequestReportPreview/ReportPreviewActionButton.tsx" "no-restricted-imports" 1
"../../src/components/ReportActionItem/MoneyRequestReportPreview/SubmitActionButton.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/ReportActionItem/MoneyRequestReportPreview/useReportPreviewActionDecision.ts" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/ReportActionItem/TaskPreview.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/ReportActionItem/TaskView.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
Expand Down Expand Up @@ -523,7 +519,6 @@
"../../src/components/Tooltip/GenericTooltip.tsx" "react-hooks/set-state-in-effect" 1
"../../src/components/Tooltip/PopoverAnchorTooltip.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/Tooltip/PopoverAnchorTooltip.tsx" "react-hooks/refs" 7
"../../src/components/TransactionItemRow/DataCells/ChatBubbleCell.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/components/TransactionItemRow/DataCells/MerchantCell.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/TransactionItemRow/EditableCell/usePopoverEditState.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/components/UpdateAppModal.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
Expand Down Expand Up @@ -591,7 +586,6 @@
"../../src/hooks/useKeyboardShortcut.ts" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/hooks/useLazyAsset.ts" "@typescript-eslint/no-unsafe-type-assertion" 3
"../../src/hooks/useLazyAsset.ts" "react-hooks/set-state-in-effect" 1
"../../src/hooks/useLifecycleActions.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/hooks/useListKeyboardNav.ts" "@typescript-eslint/no-unsafe-type-assertion" 2
"../../src/hooks/useNativeCamera.ts" "react-hooks/refs" 1
"../../src/hooks/useNewTransactions.ts" "react-hooks/refs" 2
Expand Down Expand Up @@ -1174,7 +1168,6 @@
"../../src/pages/RejectExpenseReportPage.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/pages/ReportDescriptionPage.tsx" "no-restricted-imports" 1
"../../src/pages/ReportDescriptionPage.tsx" "no-restricted-syntax" 1
"../../src/pages/ReportSubmitToContent.tsx" "rulesdir/no-useOnyx-dependencies-arg" 1
"../../src/pages/RequireTwoFactorAuthenticationOverlay.tsx" "no-restricted-imports" 1
"../../src/pages/RestrictedAction/Workspace/WorkspaceAdminRestrictedAction.tsx" "no-restricted-imports" 1
"../../src/pages/RestrictedAction/Workspace/WorkspaceOwnerRestrictedAction/index.native.tsx" "no-restricted-imports" 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ import ONYXKEYS from '@src/ONYXKEYS';
import type {Route} from '@src/ROUTES';
import {DYNAMIC_ROUTES} from '@src/ROUTES';
import {personalDetailsLoginSelector} from '@src/selectors/PersonalDetails';
import type {PersonalDetailsList} from '@src/types/onyx';
import type {PaymentMethodType} from '@src/types/onyx/OriginalMessage';

import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';

import {delegateEmailSelector, isUserValidatedSelector} from '@selectors/Account';
Expand Down Expand Up @@ -103,13 +105,10 @@ function MoneyReportHeaderSecondaryActionsInner({reportID, primaryAction, isRepo
const [moneyRequestReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(moneyRequestReport?.policyID)}`);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(moneyRequestReport?.chatReportID)}`);
const [submitterLogin] = useOnyx(
ONYXKEYS.PERSONAL_DETAILS_LIST,
{
selector: personalDetailsLoginSelector(moneyRequestReport?.ownerAccountID),
},
[moneyRequestReport?.ownerAccountID],
);
const ownerAccountID = moneyRequestReport?.ownerAccountID;
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: (personalDetailsList: OnyxEntry<PersonalDetailsList>) => personalDetailsLoginSelector(ownerAccountID)(personalDetailsList),
});
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID}`);
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${moneyRequestReport?.reportID}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {Route} from '@src/ROUTES';
import {personalDetailsLoginSelector} from '@src/selectors/PersonalDetails';
import type {PersonalDetailsList} from '@src/types/onyx';

import type {StyleProp, ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';

import {useRoute} from '@react-navigation/native';
Expand Down Expand Up @@ -72,7 +74,10 @@ function MoneyReportHeaderSelectionDropdown({reportID, primaryAction, isReportIn
const [moneyRequestReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(reportID)}`);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(moneyRequestReport?.chatReportID)}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(moneyRequestReport?.policyID)}`);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(moneyRequestReport?.ownerAccountID)}, [moneyRequestReport?.ownerAccountID]);
const ownerAccountID = moneyRequestReport?.ownerAccountID;
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: (personalDetailsList: OnyxEntry<PersonalDetailsList>) => personalDetailsLoginSelector(ownerAccountID)(personalDetailsList),
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
const ownerAccountID = moneyRequestReport?.ownerAccountID;
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: (personalDetailsList: OnyxEntry<PersonalDetailsList>) => personalDetailsLoginSelector(ownerAccountID)(personalDetailsList),
});
const ownerAccountID = moneyRequestReport?.ownerAccountID;
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: personalDetailsLoginSelector(ownerAccountID),
});

Does this work?

const [session] = useOnyx(ONYXKEYS.SESSION);
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function SubmitPrimaryActionContent({reportID}: SubmitPrimaryActionProps) {

const [moneyRequestReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(moneyRequestReport?.policyID)}`);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(moneyRequestReport?.ownerAccountID)}, [moneyRequestReport?.ownerAccountID]);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(moneyRequestReport?.ownerAccountID)});
const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${reportID}`);
const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function SubmitActionButtonContent() {

const [iouReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${iouReport?.policyID}`);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(iouReport?.ownerAccountID)}, [iouReport?.ownerAccountID]);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(iouReport?.ownerAccountID)});
const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END);
const [iouReportNextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReportID}`);
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
Expand Down
17 changes: 4 additions & 13 deletions src/components/TransactionItemRow/DataCells/ChatBubbleCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type Transaction from '@src/types/onyx/Transaction';
import type {ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';

import React, {useCallback, useMemo} from 'react';
import React, {useMemo} from 'react';
import {View} from 'react-native';

const isReportUnread = ({lastReadTime = '', lastVisibleActionCreated = '', lastMentionedTime = ''}: Report): boolean =>
Expand All @@ -33,20 +33,11 @@ function ChatBubbleCell({transaction, containerStyles, isInSingleTransactionRepo
const {shouldUseNarrowLayout} = useResponsiveLayout();
const nonEmptyStringTransactionReportID = getNonEmptyStringOnyxID(transaction.reportID);

const getIOUActionForTransactionIDSelector = useCallback(
(reportActions: OnyxEntry<ReportActions>): OnyxEntry<ReportAction> => {
const [iouReportAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${nonEmptyStringTransactionReportID}`, {
selector: (reportActions: OnyxEntry<ReportActions>): OnyxEntry<ReportAction> => {
return getIOUActionForTransactionID(Object.values(reportActions ?? {}), transaction.transactionID);
},
[transaction.transactionID],
);

const [iouReportAction] = useOnyx(
`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${nonEmptyStringTransactionReportID}`,
{
selector: getIOUActionForTransactionIDSelector,
},
[getIOUActionForTransactionIDSelector],
);
});

const [childReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${iouReportAction?.childReportID}`);

Expand Down
10 changes: 3 additions & 7 deletions src/hooks/useLifecycleActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,9 @@ function useLifecycleActions({reportID, startApprovedAnimation, startAnimation,
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(moneyRequestReport?.policyID)}`);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(moneyRequestReport?.chatReportID)}`);
const [chatReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getNonEmptyStringOnyxID(moneyRequestReport?.chatReportID)}`);
const [submitterLogin] = useOnyx(
ONYXKEYS.PERSONAL_DETAILS_LIST,
{
selector: personalDetailsLoginSelector(moneyRequestReport?.ownerAccountID),
},
[moneyRequestReport?.ownerAccountID],
);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
selector: personalDetailsLoginSelector(moneyRequestReport?.ownerAccountID),
});
const [nextStep] = useOnyx(`${ONYXKEYS.COLLECTION.NEXT_STEP}${moneyRequestReport?.reportID}`);
const [allTransactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
const [betas] = useOnyx(ONYXKEYS.BETAS);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReportSubmitToContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function ReportSubmitToContent({
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGracePeriodEnd] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const [delegateEmail] = useOnyx(ONYXKEYS.ACCOUNT, {selector: delegateEmailSelector});
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(report?.ownerAccountID)}, [report?.ownerAccountID]);
const [submitterLogin] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {selector: personalDetailsLoginSelector(report?.ownerAccountID)});
const [loginList] = useOnyx(ONYXKEYS.LOGINS, {selector: expensifyLoginsSelector});
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE);
Expand Down
Loading