Skip to content

Commit 115d69e

Browse files
committed
hide pending deleted workspace from change workspace list
1 parent 11e2e5e commit 115d69e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/hooks/useWorkspaceList.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type WorkspaceListItem = {
1919
type UseWorkspaceListParams = {
2020
policies: OnyxCollection<Policy>;
2121
currentUserLogin: string | undefined;
22-
isOffline: boolean;
22+
shouldShowPendingDeletePolicy: boolean;
2323
selectedPolicyID: string | undefined;
2424
searchTerm: string;
2525
additionalFilter?: (policy: OnyxEntry<Policy>) => boolean;
@@ -41,7 +41,7 @@ function useWorkspaceList({
4141
currentUserLogin,
4242
selectedPolicyID,
4343
searchTerm,
44-
isOffline,
44+
shouldShowPendingDeletePolicy,
4545
isWorkspaceSwitcher = false,
4646
hasUnreadData,
4747
getIndicatorTypeForPolicy,
@@ -53,7 +53,7 @@ function useWorkspaceList({
5353
}
5454

5555
return Object.values(policies)
56-
.filter((policy) => !!policy && shouldShowPolicy(policy, !!isOffline, currentUserLogin) && !policy?.isJoinRequestPending && (additionalFilter ? additionalFilter(policy) : true))
56+
.filter((policy) => !!policy && shouldShowPolicy(policy, shouldShowPendingDeletePolicy, currentUserLogin) && !policy?.isJoinRequestPending && (additionalFilter ? additionalFilter(policy) : true))
5757
.map((policy) => ({
5858
text: policy?.name ?? '',
5959
policyID: policy?.id,
@@ -76,7 +76,7 @@ function useWorkspaceList({
7676
brickRoadIndicator: getIndicatorTypeForPolicy(policy?.id),
7777
}),
7878
}));
79-
}, [policies, isOffline, currentUserLogin, additionalFilter, selectedPolicyID, getIndicatorTypeForPolicy, hasUnreadData, isWorkspaceSwitcher]);
79+
}, [policies, shouldShowPendingDeletePolicy, currentUserLogin, additionalFilter, selectedPolicyID, getIndicatorTypeForPolicy, hasUnreadData, isWorkspaceSwitcher]);
8080

8181
const filteredAndSortedUserWorkspaces = useMemo<WorkspaceListItem[]>(
8282
() =>

src/pages/ReportChangeWorkspacePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function ReportChangeWorkspacePage({report}: ReportChangeWorkspacePageProps) {
5151
const {sections, shouldShowNoResultsFoundMessage, shouldShowSearchInput} = useWorkspaceList({
5252
policies,
5353
currentUserLogin,
54-
isOffline,
54+
shouldShowPendingDeletePolicy: false,
5555
selectedPolicyID: report.policyID,
5656
searchTerm: debouncedSearchTerm,
5757
additionalFilter: (newPolicy) => isWorkspaceEligibleForReportChange(newPolicy, report, oldPolicy, currentUserLogin),

src/pages/WorkspaceSwitcherPage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function WorkspaceSwitcherPage() {
7070

7171
const {sections, shouldShowNoResultsFoundMessage, shouldShowSearchInput, shouldShowCreateWorkspace} = useWorkspaceList({
7272
policies,
73-
isOffline,
73+
shouldShowPendingDeletePolicy: !!isOffline,
7474
currentUserLogin,
7575
selectedPolicyID: activeWorkspaceID,
7676
searchTerm: debouncedSearchTerm,

0 commit comments

Comments
 (0)