Skip to content
Draft
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
901 changes: 228 additions & 673 deletions .github/actions/javascript/authorChecklist/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/awaitStagingDeploys/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/bumpVersion/index.js

Large diffs are not rendered by default.

903 changes: 229 additions & 674 deletions .github/actions/javascript/checkAndroidStatus/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/checkDeployBlockers/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/checkSVGCompression/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/failureNotifier/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/formatCodeCovComment/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/generateHelpPreviewComment/index.js

Large diffs are not rendered by default.

903 changes: 229 additions & 674 deletions .github/actions/javascript/getAndroidRolloutPercentage/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getArtifactInfo/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getDeployPullRequestList/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getPreviousVersion/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getPullRequestDetails/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/getPullRequestIncrementalChanges/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/isAuthorizedContributor/index.js

Large diffs are not rendered by default.

1,208 changes: 369 additions & 839 deletions .github/actions/javascript/isDeployChecklistLocked/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/markPullRequestsAsDeployed/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/postOrReplaceComment/index.js

Large diffs are not rendered by default.

1,208 changes: 369 additions & 839 deletions .github/actions/javascript/proposalPoliceComment/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/reopenIssueWithComment/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/reviewerChecklist/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/validateReassureOutput/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/verifySignedCommits/index.js

Large diffs are not rendered by default.

901 changes: 228 additions & 673 deletions .github/actions/javascript/verifyStagingBuildsSucceeded/index.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,6 @@ const ONYXKEYS = {
CARD_FEED_ERRORS: 'cardFeedErrors',
RAM_ONLY_SORTED_REPORT_ACTIONS: 'sortedReportActions',
LOGIN_TO_ACCOUNT_ID_MAP: 'loginToAccountIDMap',
GUIDE_ACCOUNT_IDS: 'guideAccountIDs',
SPEND_DATA_SIGNATURE: 'spendDataSignature',
ONE_ON_ONE_CHAT_REPORT_IDS: 'oneOnOneChatReportIDs',
},
Expand Down Expand Up @@ -2026,7 +2025,6 @@ type OnyxDerivedValuesMapping = {
[ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS]: OnyxTypes.SortedReportActionsDerivedValue;
[ONYXKEYS.DERIVED.LOGIN_TO_ACCOUNT_ID_MAP]: OnyxTypes.LoginToAccountIDMapDerivedValue;
[ONYXKEYS.DERIVED.SPEND_DATA_SIGNATURE]: OnyxTypes.SpendDataSignatureDerivedValue;
[ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS]: OnyxTypes.GuideAccountIDsDerivedValue;
[ONYXKEYS.DERIVED.ONE_ON_ONE_CHAT_REPORT_IDS]: OnyxTypes.OneOnOneChatReportIDsDerivedValue;
};

Expand Down
3 changes: 2 additions & 1 deletion src/components/ReportOrNotFoundGuard.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
import useReportIsArchived from '@hooks/useReportIsArchived';
Expand Down Expand Up @@ -89,7 +90,7 @@ function ReportOrNotFoundGuard({reportID, shouldRequireReportID = true, children
const [reportLoadingState] = useOnyx(`${ONYXKEYS.COLLECTION.RAM_ONLY_REPORT_LOADING_STATE}${reportID}`);
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
const [deleteTransactionNavigateBackUrl] = useOnyx(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const hasGuidesEmails = hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number), guideAccountIDs);
const isFocused = useIsFocused();
const isReportIdInRoute = !!reportID?.length;
Expand Down
7 changes: 5 additions & 2 deletions src/components/Table/TableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function TableBodyList({contentContainerStyle, emptyMessage, onLayout, style, ..
noResultsStateElement,
tableListMetadata,
isEmptyResult,
isDefaultViewEmpty,
scrollWidth,
tableWidth,
} = useTableContext<TableData>();
Expand Down Expand Up @@ -337,8 +338,10 @@ function TableBodyList({contentContainerStyle, emptyMessage, onLayout, style, ..
</View>
);

const emptyStateContent =
tableListMetadata.hasPageHeader && isEmptyResult ? (noResultsStateElement ?? EmptyResultComponent) : (emptyStateElement ?? renderListComponent(ListEmptyComponent));
// When the default view hides every row (e.g. all workspaces are archived), no search or filter is active,
// so show the empty state rather than "No results".
const shouldShowNoResultsState = tableListMetadata.hasPageHeader && isEmptyResult && !isDefaultViewEmpty;
const emptyStateContent = shouldShowNoResultsState ? (noResultsStateElement ?? EmptyResultComponent) : (emptyStateElement ?? renderListComponent(ListEmptyComponent));
const footerElement = renderListComponent(ListFooterComponent);
// Consumer footer flex growth is useful below normal rows, but inside the combined empty-state
// footer it can expand over the page header. Preserve the remaining style while disabling growth.
Expand Down
5 changes: 3 additions & 2 deletions src/components/Table/TableEmptyStates/TableNoResultsState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ type TableNoResultsStateProps = Omit<GenericEmptyStateComponentProps, 'headerMed
export default function TableNoResultsState(emptyStateProps: TableNoResultsStateProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {isEmptyResult, tableListMetadata} = useTableContext();
const {isEmptyResult, isDefaultViewEmpty, tableListMetadata} = useTableContext();
const illustrations = useMemoizedLazyIllustrations(['EmptyShelves']);

if (!isEmptyResult) {
// The default view hiding every row is not a search/filter result, so the empty state handles it instead.
if (!isEmptyResult || isDefaultViewEmpty) {
return null;
}

Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useFindLastAccessedReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {findLastAccessedReport} from '@libs/ReportUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

import useGuideAccountIDs from './useGuideAccountIDs';
import useOnyx from './useOnyx';
import usePermissions from './usePermissions';

Expand All @@ -19,7 +20,7 @@ function useFindLastAccessedReport({openOnAdminRoom, enabled = true}: UseFindLas
const {isBetaEnabled} = usePermissions();
const ignoreDomainRooms = !isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS);
const shouldPreferAdminRoom = openOnAdminRoom ?? shouldOpenOnAdminRoom();
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const [reportNameValuePairs, reportNameValuePairsMetadata] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS);
const [lastAccessedReportID, reportsMetadata] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {
selector: (reports) => (enabled ? findLastAccessedReport(ignoreDomainRooms, guideAccountIDs, shouldPreferAdminRoom, undefined, reportNameValuePairs, reports)?.reportID : undefined),
Expand Down
10 changes: 10 additions & 0 deletions src/hooks/useGuideAccountIDs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {guideAccountIDsSelector} from '@selectors/PersonalDetails';

import {useAllPersonalDetailsWithoutSnapshots} from './usePersonalDetails';

function useGuideAccountIDs() {
const [guideAccountIDs] = useAllPersonalDetailsWithoutSnapshots(guideAccountIDsSelector);
return guideAccountIDs;
}

export default useGuideAccountIDs;
3 changes: 2 additions & 1 deletion src/hooks/useSidebarOrderedReports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import React, {createContext, useCallback, useContext, useEffect, useMemo, useRe
import useCollectionDelta from './useCollectionDelta';
import {useCurrentReportIDState} from './useCurrentReportID';
import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails';
import useGuideAccountIDs from './useGuideAccountIDs';
import useLocalize from './useLocalize';
import useNetwork from './useNetwork';
import useOnyx from './useOnyx';
Expand Down Expand Up @@ -113,7 +114,7 @@ function SidebarOrderedReportsContextProvider({
const isDefaultRoomsBetaEnabled = isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS);
// useOnyx only gives us a new reference when the guide set actually differs, so comparing references
// below is enough to detect late guide hydration.
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const prevGuideAccountIDs = usePrevious(guideAccountIDs);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const reportAttributes = useReportAttributes();
Expand Down
5 changes: 2 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import type {
BankAccountList,
Card,
CardList,
GuideAccountIDsDerivedValue,
IntroSelected,
OnyxInputOrEntry,
OutstandingReportsByPolicyIDDerivedValue,
Expand Down Expand Up @@ -2541,7 +2540,7 @@ function isHiddenForCurrentUser(reportOrPreference: OnyxEntry<Report> | string |
* by cross-referencing the accountIDs with personalDetails since guides that are participants
* of the user's chats should have their personal details in Onyx.
*/
function hasExpensifyGuidesEmails(accountIDs: number[], guideAccountIDs: GuideAccountIDsDerivedValue | undefined): boolean {
function hasExpensifyGuidesEmails(accountIDs: number[], guideAccountIDs: number[] | undefined): boolean {
if (guideAccountIDs) {
return accountIDs.some((accountID) => guideAccountIDs.includes(accountID));
}
Expand Down Expand Up @@ -2578,7 +2577,7 @@ function toLastAccessedReport(report: OnyxEntry<Report>): LastAccessedReport | u
*/
function findLastAccessedReport(
ignoreDomainRooms: boolean,
guideAccountIDs: GuideAccountIDsDerivedValue | undefined,
guideAccountIDs: number[] | undefined,
openOnAdminRoom = false,
excludeReportID?: string,
reportNameValuePairs?: OnyxCollection<ReportNameValuePairs>,
Expand Down
5 changes: 2 additions & 3 deletions src/libs/SidebarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {
Card,
GuideAccountIDsDerivedValue,
PersonalDetails,
PersonalDetailsList,
PolicyTagLists,
Expand Down Expand Up @@ -312,7 +311,7 @@ function getReportsToDisplayInLHN({
currentUserAccountID: number;
reportNameValuePairs?: OnyxCollection<ReportNameValuePairs>;
reportAttributes?: ReportAttributesDerivedValue['reports'];
guideAccountIDs?: GuideAccountIDsDerivedValue;
guideAccountIDs?: number[];
conciergeReportID: string | undefined;
}) {
rememberLHNUnreadStateBeforeFocus(currentReportId);
Expand Down Expand Up @@ -374,7 +373,7 @@ type UpdateReportsToDisplayInLHNProps = {
isOffline: boolean;
currentUserLogin: string;
currentUserAccountID: number;
guideAccountIDs?: GuideAccountIDsDerivedValue;
guideAccountIDs?: number[];
conciergeReportID: string | undefined;
};

Expand Down
2 changes: 0 additions & 2 deletions src/libs/actions/OnyxDerived/ONYX_DERIVED_VALUES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {ValueOf} from 'type-fest';
import type {OnyxDerivedValueConfig} from './types';

import cardFeedErrorsConfig from './configs/cardFeedErrors';
import guideAccountIDsConfig from './configs/guideAccountIDs';
import loginToAccountIDMapConfig from './configs/loginToAccountIDMap';
import nonPersonalAndWorkspaceCardListConfig from './configs/nonPersonalAndWorkspaceCardList';
import oneOnOneChatReportIDsConfig from './configs/oneOnOneChatReportIDs';
Expand All @@ -31,7 +30,6 @@ const ONYX_DERIVED_VALUES = {
[ONYXKEYS.DERIVED.CARD_FEED_ERRORS]: cardFeedErrorsConfig,
[ONYXKEYS.DERIVED.RAM_ONLY_SORTED_REPORT_ACTIONS]: sortedReportActionsConfig,
[ONYXKEYS.DERIVED.LOGIN_TO_ACCOUNT_ID_MAP]: loginToAccountIDMapConfig,
[ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS]: guideAccountIDsConfig,
[ONYXKEYS.DERIVED.SPEND_DATA_SIGNATURE]: spendDataSignatureConfig,
[ONYXKEYS.DERIVED.ONE_ON_ONE_CHAT_REPORT_IDS]: oneOnOneChatReportIDsConfig,
} as const satisfies {
Expand Down
32 changes: 0 additions & 32 deletions src/libs/actions/OnyxDerived/configs/guideAccountIDs.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/pages/Debug/Report/DebugReportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ScreenWrapper from '@components/ScreenWrapper';
import Text from '@components/Text';

import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
Expand Down Expand Up @@ -91,7 +92,7 @@ function DebugReportPage({
const [reportOwnerPersonalDetail] = usePersonalDetail(report?.ownerAccountID);
const transactionID = DebugUtils.getTransactionID(report, reportActions);
const isReportArchived = useReportIsArchived(reportID);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const hasGuidesEmails = hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number), guideAccountIDs);
const derivedIsEmptyReport = useDerivedIsEmptyReport(reportID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {ModalActions} from '@components/Modal/Global/ModalContext';

import useConfirmModal from '@hooks/useConfirmModal';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
Expand Down Expand Up @@ -37,7 +38,7 @@ function ReportDetailsMenuLeaveItem({reportID}: ReportDetailsMenuLeaveItemProps)
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`);
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${reportID}`);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import MenuItemAction from '@components/MenuItem/presets/MenuItemAction';

import useAncestors from '@hooks/useAncestors';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import useHasOutstandingChildTask from '@hooks/useHasOutstandingChildTask';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -46,7 +47,7 @@ function ReportDetailsTaskDeleteActionContent({report, parentReport, parentRepor
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Trashcan']);
const taskDeleteBackTo = Navigation.getTopmostSearchReportRouteParams()?.backTo;
const hasOutstandingChildTask = useHasOutstandingChildTask(report);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [reportActionsForOriginalReportID] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`);
const [delegateEmail] = useOnyx(ONYXKEYS.ACCOUNT, {selector: delegateEmailSelector});
Expand Down Expand Up @@ -88,7 +89,7 @@ function ReportDetailsTaskDeleteAction({reportID, caseID}: ReportDetailsTaskDele
const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`);
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${report?.parentReportID}`);
const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const parentReportAction = useParentReportAction(report);
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const currentUserAccountID = currentUserPersonalDetails?.accountID;
Expand Down
3 changes: 2 additions & 1 deletion src/pages/inbox/report/AncestorReportActionItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import OfflineWithFeedback from '@components/OfflineWithFeedback';

import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
Expand Down Expand Up @@ -87,7 +88,7 @@ function AncestorReportActionItem({
const styles = useThemeStyles();
const currentUserPersonalDetail = useCurrentUserPersonalDetails();
const [reportOwnerPersonalDetail] = usePersonalDetail(report?.ownerAccountID);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const hasGuidesEmails = hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number), guideAccountIDs);
const [chatReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.chatReportID)}`, {selector: getStableReportSelector});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator';

import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import useOnyx from '@hooks/useOnyx';
import useParentReportAction from '@hooks/useParentReportAction';
import usePermissions from '@hooks/usePermissions';
Expand Down Expand Up @@ -60,7 +61,7 @@ function WithReportOrNotFoundImpl<TProps extends WithReportAndReportActionOrNotF
const [reportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${props.route.params.reportID}`);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails();
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const hasGuidesEmails = hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number), guideAccountIDs);

const parentReportAction = useParentReportAction(report);
Expand Down
3 changes: 2 additions & 1 deletion src/pages/inbox/report/withReportOrNotFound.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import FullscreenLoadingIndicator from '@components/FullscreenLoadingIndicator';
import {getReportOrNotFoundDecision} from '@components/ReportOrNotFoundGuard';

import useGuideAccountIDs from '@hooks/useGuideAccountIDs';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
import useReportIsArchived from '@hooks/useReportIsArchived';
Expand Down Expand Up @@ -85,7 +86,7 @@ export default function (shouldRequireReportID = true): <TProps extends WithRepo
const [reportLoadingState] = useOnyx(`${ONYXKEYS.COLLECTION.RAM_ONLY_REPORT_LOADING_STATE}${reportID}`);
const [isLoadingReportData] = useOnyx(ONYXKEYS.IS_LOADING_REPORT_DATA);
const [deleteTransactionNavigateBackUrl] = useOnyx(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL);
const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS);
const guideAccountIDs = useGuideAccountIDs();
const hasGuidesEmails = hasExpensifyGuidesEmails(Object.keys(report?.participants ?? {}).map(Number), guideAccountIDs);
const isFocused = useIsFocused();
const contentShown = React.useRef(false);
Expand Down
18 changes: 18 additions & 0 deletions src/selectors/PersonalDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject';

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

import {Str} from 'expensify-common';

const personalDetailsSelector = (accountID: number | undefined) => (personalDetailsList: OnyxEntry<PersonalDetailsList>) => getPersonalDetailsByID(accountID, personalDetailsList);

const multiPersonalDetailsSelector = (accountIDs: number[] | undefined) => (personalDetails: OnyxEntry<PersonalDetailsList>) => getPersonalDetailsByIDs(accountIDs, personalDetails);
Expand Down Expand Up @@ -95,6 +97,21 @@ const optimisticPersonalDetailsSelector = (personalDetailsList: OnyxEntry<Person
return optimisticPersonalDetails;
};

/**
* Returns the accountIDs of every Expensify Guide (identified by login domain). Sorted so an unrelated
* personal-details change selects a deep-equal array and subscribers don't re-render.
*/
const guideAccountIDsSelector = (personalDetailsList: OnyxEntry<PersonalDetailsList>): number[] => {
const guideAccountIDs: number[] = [];
for (const personalDetails of Object.values(personalDetailsList ?? {})) {
if (!personalDetails?.login || Str.extractEmailDomain(personalDetails.login) !== CONST.EMAIL.GUIDES_DOMAIN) {
continue;
}
guideAccountIDs.push(personalDetails.accountID);
}
return guideAccountIDs.sort((a, b) => a - b);
};

const newAccountIDsAndLoginsSelector = (invitedEmailsToAccountIDs: InvitedEmailsToAccountIDs | undefined) => (personalDetailsList: OnyxEntry<PersonalDetailsList>) =>
getNewAccountIDsAndLogins(invitedEmailsToAccountIDs, personalDetailsList);

Expand Down Expand Up @@ -125,6 +142,7 @@ export {
accountIDToLoginSelector,
isPersonalDetailOptimistic,
optimisticPersonalDetailsSelector,
guideAccountIDsSelector,
createDisplayDetailsByAccountIDsSelector,
newAccountIDsAndLoginsSelector,
displayNameSelector,
Expand Down
Loading
Loading