Skip to content

Commit

Permalink
Merge pull request #43735 from rayane-djouah/Fix-All-categories-disap…
Browse files Browse the repository at this point in the history
…pear-instead-of-crossed-out-when-deleted-offline

Fix: All categories disappear instead of crossed out when deleted offline
  • Loading branch information
Beamanator authored Jul 1, 2024
2 parents 57622ff + 5c2d278 commit 486c070
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pages/workspace/categories/WorkspaceCategoriesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) {

const isLoading = !isOffline && policyCategories === null;

const shouldShowEmptyState = !categoryList.some((category) => category.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) && !isLoading;
const hasVisibleCategories = categoryList.some((category) => category.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || isOffline);

const getHeaderText = () => (
<View style={[styles.ph5, styles.pb5, styles.pt3]}>
Expand Down Expand Up @@ -309,22 +309,22 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) {
danger
/>
{shouldUseNarrowLayout && <View style={[styles.pl5, styles.pr5]}>{getHeaderButtons()}</View>}
{(!shouldUseNarrowLayout || shouldShowEmptyState || isLoading) && getHeaderText()}
{(!shouldUseNarrowLayout || categoryList.length === 0 || isLoading) && getHeaderText()}
{isLoading && (
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
style={[styles.flex1]}
color={theme.spinner}
/>
)}
{shouldShowEmptyState && (
{!hasVisibleCategories && !isLoading && (
<WorkspaceEmptyStateSection
title={translate('workspace.categories.emptyCategories.title')}
icon={Illustrations.EmptyStateExpenses}
subtitle={translate('workspace.categories.emptyCategories.subtitle')}
/>
)}
{!shouldShowEmptyState && !isLoading && (
{hasVisibleCategories && !isLoading && (
<SelectionList
canSelectMultiple
sections={[{data: categoryList, isDisabled: false}]}
Expand Down

0 comments on commit 486c070

Please sign in to comment.