Skip to content

Commit 599ad91

Browse files
committed
fixup! Throw error if no default org
1 parent 4a7c9d9 commit 599ad91

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

site/src/pages/ManagementSettingsPage/GroupsPage/GroupsPage.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getErrorMessage } from "api/errors";
88
import { groups } from "api/queries/groups";
99
import { organizationPermissions } from "api/queries/organizations";
1010
import type { Organization } from "api/typesGenerated";
11+
import { EmptyState } from "components/EmptyState/EmptyState";
1112
import { displayError } from "components/GlobalSnackbar/utils";
1213
import { Loader } from "components/Loader/Loader";
1314
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
@@ -56,7 +57,11 @@ export const GroupsPage: FC = () => {
5657
return <Navigate to={`/organizations/${defaultName}/groups`} replace />;
5758
}
5859
// We expect there to always be a default organization.
59-
throw new Error("No default organization found")
60+
throw new Error("No default organization found");
61+
}
62+
63+
if (!organization) {
64+
return <EmptyState message="Organization not found" />;
6065
}
6166

6267
const permissions = permissionsQuery.data;

site/src/pages/ManagementSettingsPage/OrganizationSettingsPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ const OrganizationSettingsPage: FC = () => {
4747
if (defaultOrg) {
4848
return <Navigate to={`/organizations/${defaultOrg.name}`} replace />;
4949
}
50-
return <EmptyState message="No default organization found" />;
50+
// We expect there to always be a default organization.
51+
throw new Error("No default organization found");
5152
}
5253

5354
if (!organization) {

0 commit comments

Comments
 (0)