From d8cb98fc89ee451cc8a6e951a8ba63928e8cc361 Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Wed, 23 Oct 2024 21:14:13 +0200 Subject: [PATCH 1/2] improve isLoading to prevent loading for undefined --- src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx index 4d3e5a347266..9a20ce24eac6 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx @@ -34,8 +34,8 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) { const selectedFeed = CardUtils.getSelectedFeed(lastSelectedFeed, cardFeeds); const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${selectedFeed}`); - const isLoading = !cardFeeds || !!(cardFeeds.isLoading && !cardFeeds.settings); const companyCards = cardFeeds?.settings?.companyCards ?? {}; + const isLoading = !cardFeeds || !!(cardFeeds.isLoading && !companyCards); const selectedCompanyCard = companyCards[selectedFeed ?? ''] ?? null; const isNoFeed = !selectedCompanyCard; const isPending = !!selectedCompanyCard?.pending; From cece8df8c12c3269123d2482ab1c8f603c24a6cc Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Wed, 6 Nov 2024 01:03:28 +0100 Subject: [PATCH 2/2] update expensify card loading adding brickRoad --- src/pages/workspace/WorkspaceInitialPage.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index f9d1fedb91c1..b1fa946a6a4a 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -86,6 +86,8 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac const [isCurrencyModalOpen, setIsCurrencyModalOpen] = useState(false); const hasPolicyCreationError = !!(policy?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD && !isEmptyObject(policy.errors)); const [cardFeeds] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`); + const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${workspaceAccountID}`); + const [cardsList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}${workspaceAccountID}_${CONST.EXPENSIFY_CARD.BANK}`); const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policy?.id}`); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${route.params?.policyID ?? '-1'}`); const hasSyncError = PolicyUtils.hasSyncError(policy, isConnectionInProgress(connectionSyncProgress, policy)); @@ -211,6 +213,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac icon: Expensicons.ExpensifyCard, action: singleExecution(waitForNavigate(() => Navigation.navigate(ROUTES.WORKSPACE_EXPENSIFY_CARD.getRoute(policyID)))), routeName: SCREENS.WORKSPACE.EXPENSIFY_CARD, + brickRoadIndicator: !isEmptyObject(cardsList?.cardList?.errorFields ?? {}) || !isEmptyObject(cardSettings?.errors ?? {}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined, }); }