Skip to content

Commit 7ced657

Browse files
committed
fix: simplify loading states
1 parent 8f76cb9 commit 7ced657

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • src/pages/workspace/companyCards/WorkspaceCompanyCardsTable

src/pages/workspace/companyCards/WorkspaceCompanyCardsTable/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function WorkspaceCompanyCardsTable({
119119
const isLoadingFeed = (!feedName && isInitiallyLoadingFeeds) || !isPolicyLoaded || isLoadingOnyxValue(lastSelectedFeedMetadata) || !!selectedFeedStatus?.isLoading;
120120
const isLoadingCards = cardFeedType === 'directFeed' ? selectedFeed?.accountList === undefined : isLoadingOnyxValue(cardListMetadata) || cardList === undefined;
121121
const isLoadingPage = !isOffline && (isLoadingFeed || isLoadingOnyxValue(personalDetailsMetadata) || areWorkspaceCardFeedsLoading);
122-
const isShowingLoadingState = isLoadingPage || isLoadingFeed;
122+
const isLoading = isLoadingPage || isLoadingFeed;
123123

124124
const showCards = !isInitiallyLoadingFeeds && !isFeedPending && !isNoFeed && !isLoadingFeed && !hasFeedErrors;
125125
const showTableControls = showCards && !!selectedFeed && !isLoadingCards && !hasFeedErrors;
@@ -358,17 +358,17 @@ function WorkspaceCompanyCardsTable({
358358
>
359359
{shouldRenderHeaderAsChild && headerButtonsComponent}
360360

361-
{(isLoadingPage || isFeedPending || isNoFeed) && !feedErrorKey && (
361+
{(isLoading || isFeedPending || isNoFeed) && !feedErrorKey && (
362362
<ScrollView>
363-
{isLoadingPage && <TableRowSkeleton fixedNumItems={5} />}
363+
{isLoading && <TableRowSkeleton fixedNumItems={5} />}
364364

365-
{!isLoadingPage && isFeedPending && (
365+
{!isLoading && isFeedPending && (
366366
<View style={styles.flex1}>
367367
<WorkspaceCompanyCardsFeedPendingPage />
368368
</View>
369369
)}
370370

371-
{!isLoadingPage && isNoFeed && (
371+
{!isLoading && isNoFeed && (
372372
<View style={styles.flex1}>
373373
<WorkspaceCompanyCardPageEmptyState
374374
policyID={policyID}
@@ -379,7 +379,7 @@ function WorkspaceCompanyCardsTable({
379379
</ScrollView>
380380
)}
381381

382-
{!!feedErrorKey && !isShowingLoadingState && (
382+
{!!feedErrorKey && !isLoading && (
383383
<ScrollView contentContainerStyle={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter, bottomSafeAreaPaddingStyle]}>
384384
<View style={[styles.alignItemsCenter]}>
385385
<BlockingView

0 commit comments

Comments
 (0)