Skip to content
Merged
Show file tree
Hide file tree
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 @@ -2,7 +2,6 @@
import type {ListRenderItemInfo} from '@react-native/virtualized-lists/Lists/VirtualizedList';
import {useIsFocused, useRoute} from '@react-navigation/native';
import {isUserValidatedSelector} from '@selectors/Account';
import {accountIDSelector} from '@selectors/Session';
import {tierNameSelector} from '@selectors/UserWallet';
import isEmpty from 'lodash/isEmpty';
import React, {useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react';
Expand All @@ -20,6 +19,7 @@ import {PressableWithFeedback} from '@components/Pressable';
import ScrollView from '@components/ScrollView';
import {useSearchContext} from '@components/Search/SearchContext';
import Text from '@components/Text';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import {AUTOSCROLL_TO_TOP_THRESHOLD} from '@hooks/useFlatListScrollKey';
import useLoadReportActions from '@hooks/useLoadReportActions';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -64,7 +64,7 @@ import ReportActionsListItemRenderer from '@pages/home/report/ReportActionsListI
import shouldDisplayNewMarkerOnReportAction from '@pages/home/report/shouldDisplayNewMarkerOnReportAction';
import useReportUnreadMessageScrollTracking from '@pages/home/report/useReportUnreadMessageScrollTracking';
import variables from '@styles/variables';
import {getCurrentUserAccountID, openReport, readNewestAction, subscribeToNewActionEvent} from '@userActions/Report';
import {openReport, readNewestAction, subscribeToNewActionEvent} from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -167,7 +167,7 @@ function MoneyRequestReportActionsList({
const transactionThreadReportID = getOneTransactionThreadReportID(report, chatReport, reportActions ?? [], false, reportTransactionIDs);
const firstVisibleReportActionID = useMemo(() => getFirstVisibleReportActionID(reportActions, isOffline), [reportActions, isOffline]);
const [transactionThreadReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReportID}`, {canBeMissing: true});
const [currentUserAccountID] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false, selector: accountIDSelector});
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();

const isReportArchived = useReportIsArchived(reportID);
const canPerformWriteAction = canUserPerformWriteAction(report, isReportArchived);
Expand Down Expand Up @@ -349,7 +349,7 @@ function MoneyRequestReportActionsList({

const hasNewMessagesInView = scrollingVerticalBottomOffset.current < CONST.REPORT.ACTIONS.ACTION_VISIBLE_THRESHOLD;
const hasUnreadReportAction = reportActions.some(
(reportAction) => newMessageTimeReference && newMessageTimeReference < reportAction.created && reportAction.actorAccountID !== getCurrentUserAccountID(),
(reportAction) => newMessageTimeReference && newMessageTimeReference < reportAction.created && reportAction.actorAccountID !== currentUserAccountID,
);

if (!hasNewMessagesInView || !hasUnreadReportAction) {
Expand Down Expand Up @@ -399,7 +399,7 @@ function MoneyRequestReportActionsList({
message: reportAction,
nextMessage: nextAction,
isEarliestReceivedOfflineMessage,
accountID: currentUserAccountID,
currentUserAccountID,
prevSortedVisibleReportActionsObjects: prevVisibleActionsMap,
unreadMarkerTime,
scrollingVerticalOffset: scrollingVerticalBottomOffset.current,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {useMemo} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useOnyx from '@hooks/useOnyx';
import useTransactionsAndViolationsForReport from '@hooks/useTransactionsAndViolationsForReport';
import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import {getAllNonDeletedTransactions} from '@libs/MoneyRequestReportUtils';
import {getPersonalDetailByEmail} from '@libs/PersonalDetailsUtils';
import {getOriginalMessage, isMoneyRequestAction, isSentMoneyReportAction} from '@libs/ReportActionsUtils';
import {isDM, isIOUReport} from '@libs/ReportUtils';
import {getCurrentUserAccountID} from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Report, ReportAction, ReportActions, Transaction} from '@src/types/onyx';
Expand Down Expand Up @@ -65,9 +65,10 @@ function useReportPreviewSenderID({iouReport, action, chatReport}: {action: Onyx
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${getNonEmptyStringOnyxID(shouldFetchData ? iouReport?.policyID : undefined)}`, {
canBeMissing: true,
});
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();

if (isOptimisticReportPreview) {
return getCurrentUserAccountID();
return currentUserAccountID;
}

// 1. If all amounts have the same sign - either all amounts are positive or all amounts are negative.
Expand Down
9 changes: 8 additions & 1 deletion src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,14 @@ function AuthScreens() {
// or returning from background. If so, we'll assume they have some app data already and we can call reconnectApp() instead of openApp() and connect() for delegator from OldDot.
if (SessionUtils.didUserLogInDuringSession() || delegatorEmail) {
if (delegatorEmail) {
connect({email: delegatorEmail, delegatedAccess: account?.delegatedAccess, credentials, session, activePolicyID, isFromOldDot: true})
connect({
email: delegatorEmail,
delegatedAccess: account?.delegatedAccess,
credentials,
session,
activePolicyID,
isFromOldDot: true,
})
?.then((success) => {
App.setAppLoading(!!success);
})
Expand Down
4 changes: 2 additions & 2 deletions src/libs/ReportPrimaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function isApproveAction(report: Report, reportTransactions: Transaction[], poli
if (isAnyReceiptBeingScanned) {
return false;
}

// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.
const currentUserAccountID = getCurrentUserAccountID();
const managerID = report?.managerID ?? CONST.DEFAULT_NUMBER_ID;
const isCurrentUserManager = managerID === currentUserAccountID;
Expand Down Expand Up @@ -209,7 +209,7 @@ function isPrimaryPayAction(

const parentReport = getParentReport(report);
if (parentReport?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL && reimbursableSpend > 0) {
return parentReport?.invoiceReceiver?.accountID === getCurrentUserAccountID();
return parentReport?.invoiceReceiver?.accountID === currentUserAccountID;
}

return invoiceReceiverPolicy?.role === CONST.POLICY.ROLE.ADMIN && reimbursableSpend > 0;
Expand Down
4 changes: 4 additions & 0 deletions src/libs/ReportSecondaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ function isSplitAction(

const isSubmitter = isCurrentUserSubmitter(report);
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.

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.

I love the comment to go along with these. Thank you!

const isManager = (report.managerID ?? CONST.DEFAULT_NUMBER_ID) === getCurrentUserAccountID();
const isOpenReport = isOpenReportUtils(report);
const isPolicyExpenseChat = !!policy?.isPolicyExpenseChatEnabled;
Expand Down Expand Up @@ -216,6 +217,7 @@ function isSubmitAction({

const isReportSubmitter = isCurrentUserSubmitter(report);
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.
const isManager = report.managerID === getCurrentUserAccountID();
if (!isReportSubmitter && !isAdmin && !isManager) {
return false;
Expand Down Expand Up @@ -260,6 +262,7 @@ function isApproveAction(currentUserLogin: string, report: Report, reportTransac
return false;
}

// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.
const currentUserAccountID = getCurrentUserAccountID();
const managerID = report?.managerID ?? CONST.DEFAULT_NUMBER_ID;
const isCurrentUserManager = managerID === currentUserAccountID;
Expand Down Expand Up @@ -318,6 +321,7 @@ function isUnapproveAction(currentUserLogin: string, report: Report, policy?: Po
const isReportSettled = isSettled(report);
const isPaymentProcessing = report.isWaitingOnBankAccount && report.statusNum === CONST.REPORT.STATUS_NUM.APPROVED;
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.
const isManager = report.managerID === getCurrentUserAccountID();

if (isReportSettled || !isExpenseReport || !isReportApproved || isPaymentProcessing) {
Expand Down
3 changes: 1 addition & 2 deletions src/libs/TransactionPreviewUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {TranslationPaths} from '@src/languages/types';
import ROUTES from '@src/ROUTES';
import type * as OnyxTypes from '@src/types/onyx';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import {getCurrentUserAccountID} from './actions/Report';
import {abandonReviewDuplicateTransactions, setReviewDuplicatesKey} from './actions/Transaction';
import {isCategoryMissing} from './CategoryUtils';
import {convertToDisplayString} from './CurrencyUtils';
Expand Down Expand Up @@ -423,7 +422,7 @@ function createTransactionPreviewConditionals({
// When there are no settled transactions in duplicates, show the "Keep this one" button
const shouldShowKeepButton = areThereDuplicates;
const participantAccountIDs = isMoneyRequestAction(action) && isBillSplit ? (getOriginalMessage(action)?.participantAccountIDs ?? []) : [];
const shouldShowSplitShare = isBillSplit && !!requestAmount && requestAmount > 0 && participantAccountIDs.includes(getCurrentUserAccountID());
const shouldShowSplitShare = isBillSplit && !!requestAmount && requestAmount > 0 && participantAccountIDs.includes(currentUserAccountID);
/*
Show the merchant for IOUs and expenses only if:
- the merchant is not empty, is custom, or is not related to scanning smartscan;
Expand Down
5 changes: 1 addition & 4 deletions src/libs/actions/Delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type Credentials from '@src/types/onyx/Credentials';
import type Response from '@src/types/onyx/Response';
import type Session from '@src/types/onyx/Session';
import {confirmReadyToOpenApp, openApp} from './App';
import {getCurrentUserAccountID} from './Report';
import updateSessionAuthTokens from './Session/updateSessionAuthTokens';
import updateSessionUser from './Session/updateSessionUser';

Expand Down Expand Up @@ -124,8 +123,6 @@ function connect({email, delegatedAccess, credentials, session, activePolicyID,
Onyx.set(ONYXKEYS.STASHED_CREDENTIALS, credentials ?? {});
Onyx.set(ONYXKEYS.STASHED_SESSION, session ?? {});

const previousAccountID = getCurrentUserAccountID();

const optimisticData: Array<OnyxUpdate<typeof ONYXKEYS.ACCOUNT>> = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -208,7 +205,7 @@ function connect({email, delegatedAccess, credentials, session, activePolicyID,
newDotCurrentAccountEmail: email,
authToken: restrictedToken,
policyID,
accountID: String(previousAccountID),
accountID: String(session?.accountID ?? CONST.DEFAULT_NUMBER_ID),
});
return true;
});
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 739 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -837,7 +837,7 @@
};

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 840 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -851,7 +851,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 854 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -860,7 +860,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 863 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -874,7 +874,7 @@
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStepDeprecated>> = {};
Onyx.connect({

Check warning on line 877 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -883,7 +883,7 @@
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 886 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -892,7 +892,7 @@
});

let allReportNameValuePairs: OnyxCollection<OnyxTypes.ReportNameValuePairs>;
Onyx.connect({

Check warning on line 895 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -902,7 +902,7 @@

let userAccountID = -1;
let currentUserEmail = '';
Onyx.connect({

Check warning on line 905 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
currentUserEmail = value?.email ?? '';
Expand All @@ -911,7 +911,7 @@
});

let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>;
Onyx.connect({

Check warning on line 914 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
deprecatedCurrentUserPersonalDetails = value?.[userAccountID] ?? undefined;
Expand All @@ -919,7 +919,7 @@
});

let allReportActions: OnyxCollection<OnyxTypes.ReportActions>;
Onyx.connect({

Check warning on line 922 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -10108,6 +10108,7 @@
isReportArchived: boolean,
currentUserEmailParam: string,
) {
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.
const currentUserAccountID = getCurrentUserAccountID();
const isOpenExpenseReport = isOpenExpenseReportReportUtils(report);
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
Expand Down
3 changes: 2 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3709,7 +3709,7 @@ function toggleEmojiReaction(
function doneCheckingPublicRoom() {
Onyx.set(ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, false);
}

/** @deprecated This function is deprecated and will be removed soon after migration. Use the accountID from useCurrentUserPersonalDetails hook instead. */
function getCurrentUserAccountID(): number {
return deprecatedCurrentUserAccountID;
}
Expand Down Expand Up @@ -6509,6 +6509,7 @@ export {
exportReportToPDF,
exportToIntegration,
flagComment,
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Temporarily disabling the rule for deprecated functions; it will be removed soon in https://github.com/Expensify/App/issues/73648.
getCurrentUserAccountID,
getMostRecentReportID,
getNewerActions,
Expand Down
4 changes: 1 addition & 3 deletions src/libs/actions/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import type {OnyxData} from '@src/types/onyx/Request';
import type {WaypointCollection} from '@src/types/onyx/Transaction';
import type TransactionState from '@src/types/utils/TransactionStateType';
import {getPolicyTagsData} from './Policy/Tag';
import {getCurrentUserAccountID} from './Report';

const allTransactions: OnyxCollection<Transaction> = {};
Onyx.connect({
Expand Down Expand Up @@ -752,7 +751,6 @@ function changeTransactionsReport({
const existingSelfDMReportID = findSelfDMReportID();
let selfDMReport: Report | undefined;
let selfDMCreatedReportAction: ReportAction | undefined;
const currentUserAccountID = getCurrentUserAccountID();

if (!existingSelfDMReportID && reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
const currentTime = DateUtils.getDBTime();
Expand Down Expand Up @@ -1117,7 +1115,7 @@ function changeTransactionsReport({
parentReportID: targetReportID,
parentReportActionID: optimisticMoneyRequestReportActionID,
policyID: reportID !== CONST.REPORT.UNREPORTED_REPORT_ID && newReport ? newReport.policyID : CONST.POLICY.ID_FAKE,
participants: isUnreported && shouldRemoveOtherParticipants ? {[currentUserAccountID]: participants?.[currentUserAccountID]} : participants,
participants: isUnreported && shouldRemoveOtherParticipants ? {[accountID]: participants?.[accountID]} : participants,
},
});
}
Expand Down
5 changes: 2 additions & 3 deletions src/pages/Share/ShareDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
import {addAttachmentWithComment, addComment, getCurrentUserAccountID, openReport} from '@libs/actions/Report';
import {addAttachmentWithComment, addComment, openReport} from '@libs/actions/Report';
import {canUseTouchScreen} from '@libs/DeviceCapabilities';
import {getFileName, readFileAsync} from '@libs/fileDownload/FileUtils';
import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -118,7 +118,6 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) {
}

const isDraft = isDraftReport(reportOrAccountID);
const currentUserID = getCurrentUserAccountID();

const handleShare = () => {
if (!currentAttachment || (shouldUsePreValidatedFile && !validatedFile)) {
Expand All @@ -140,7 +139,7 @@ function ShareDetailsPage({route}: ShareDetailsPageProps) {
openReport(
report.reportID,
'',
displayReport.participantsList?.filter((u) => u.accountID !== currentUserID).map((u) => u.login ?? '') ?? [],
displayReport.participantsList?.filter((u) => u.accountID !== personalDetail.accountID).map((u) => u.login ?? '') ?? [],
report,
undefined,
undefined,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/domain/Admins/DomainAdminsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {adminAccountIDsSelector, adminPendingActionSelector, technicalContactSet
import React from 'react';
import Badge from '@components/Badge';
import Button from '@components/Button';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import {useMemoizedLazyExpensifyIcons, useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand All @@ -12,7 +13,6 @@ import type {PlatformStackScreenProps} from '@navigation/PlatformStackNavigation
import type {DomainSplitNavigatorParamList} from '@navigation/types';
import BaseDomainMembersPage from '@pages/domain/BaseDomainMembersPage';
import {clearAdminError} from '@userActions/Domain';
import {getCurrentUserAccountID} from '@userActions/Report';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
Expand Down Expand Up @@ -47,7 +47,7 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
selector: technicalContactSettingsSelector,
});

const currentUserAccountID = getCurrentUserAccountID();
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const isAdmin = adminAccountIDs?.includes(currentUserAccountID);

const getCustomRightElement = (accountID: number) => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/domain/DomainNotFoundPageWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {adminAccountIDsSelector} from '@selectors/Domain';
import React, {useEffect} from 'react';
import type {FullPageNotFoundViewProps} from '@components/BlockingViews/FullPageNotFoundView';
import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useOnyx from '@hooks/useOnyx';
import Navigation from '@navigation/Navigation';
import NotFoundPage from '@pages/ErrorPage/NotFoundPage';
import {getCurrentUserAccountID} from '@userActions/Report';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
Expand All @@ -31,7 +31,7 @@ function DomainNotFoundPageWrapper({domainAccountID, shouldBeBlocked, fullPageNo
canBeMissing: true,
selector: adminAccountIDsSelector,
});
const currentUserAccountID = getCurrentUserAccountID();
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const isAdmin = adminAccountIDs?.includes(currentUserAccountID);

const shouldShowFullScreenLoadingIndicator = isLoadingOnyxValue(domainMetadata);
Expand Down
Loading
Loading