Skip to content

Commit 7d50863

Browse files
committed
refactor isDeleting
1 parent eda4e61 commit 7d50863

3 files changed

Lines changed: 3 additions & 12 deletions

File tree

src/pages/domain/Groups/DomainGroupDetailsPage.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ function DomainGroupDetailsPage({route}: DomainGroupDetailsPageProps) {
4545
selector: domainSecurityGroupSettingPendingActionSelector('deleteGroup', groupID),
4646
});
4747

48-
// Block access to a group being deleted, and avoid flashing the not-found page during RHP navigation
49-
const isDeleting = !group || !!deleteGroupPendingAction;
50-
5148
return (
5249
<DomainNotFoundPageWrapper
5350
domainAccountID={domainAccountID}
54-
shouldBeBlocked={isDeleting}
51+
shouldBeBlocked={!group || !!deleteGroupPendingAction}
5552
fullPageNotFoundViewProps={{
5653
onBackButtonPress: () => Navigation.goBack(ROUTES.DOMAIN_GROUPS.getRoute(domainAccountID)),
5754
}}

src/pages/domain/Groups/DomainGroupEditNamePage.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ function DomainGroupEditNamePage({route}: DomainGroupEditNamePageProps) {
3939
selector: domainSecurityGroupSettingPendingActionSelector('deleteGroup', groupID),
4040
});
4141

42-
// Block access to a group being deleted, and avoid flashing the not-found page during RHP navigation
43-
const isDeleting = !group || !!deleteGroupPendingAction;
44-
4542
const inputRef = useRef<AnimatedTextInputRef>(null);
4643

4744
const validate = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.EDIT_DOMAIN_GROUP_NAME_FORM>): Errors => {
@@ -59,7 +56,7 @@ function DomainGroupEditNamePage({route}: DomainGroupEditNamePageProps) {
5956
return (
6057
<DomainNotFoundPageWrapper
6158
domainAccountID={domainAccountID}
62-
shouldBeBlocked={isDeleting}
59+
shouldBeBlocked={!group || !!deleteGroupPendingAction}
6360
fullPageNotFoundViewProps={{
6461
onBackButtonPress: () => Navigation.goBack(ROUTES.DOMAIN_GROUPS.getRoute(domainAccountID)),
6562
}}

src/pages/domain/Groups/DomainGroupPreferredWorkspacePage.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ function DomainGroupPreferredWorkspacePage({route}: DomainGroupPreferredWorkspac
4444
selector: domainSecurityGroupSettingPendingActionSelector('deleteGroup', groupID),
4545
});
4646

47-
// Block access to a group being deleted, and avoid flashing the not-found page during RHP navigation
48-
const isDeleting = !group || !!deleteGroupPendingAction;
49-
5047
const currentPolicyID = group?.restrictedPrimaryPolicyID;
5148

5249
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: createAdminPoliciesSelector(currentPolicyID)});
@@ -78,7 +75,7 @@ function DomainGroupPreferredWorkspacePage({route}: DomainGroupPreferredWorkspac
7875
return (
7976
<DomainNotFoundPageWrapper
8077
domainAccountID={domainAccountID}
81-
shouldBeBlocked={isDeleting}
78+
shouldBeBlocked={!group || !!deleteGroupPendingAction}
8279
fullPageNotFoundViewProps={{
8380
onBackButtonPress: () => Navigation.goBack(ROUTES.DOMAIN_GROUPS.getRoute(domainAccountID)),
8481
}}

0 commit comments

Comments
 (0)