Skip to content

Commit 7e946a7

Browse files
committed
fix: apply feedback
1 parent ce67a66 commit 7e946a7

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

site/src/pages/ManagementSettingsPage/OrganizationProvisionersPage.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ const OrganizationProvisionersPage: FC = () => {
1414
const { organization: organizationName } = useParams() as {
1515
organization: string;
1616
};
17-
const { organizations } = useManagementSettings();
17+
const { organization } = useManagementSettings();
1818
const { entitlements } = useDashboard();
1919
const { metadata } = useEmbeddedMetadata();
2020
const buildInfoQuery = useQuery(buildInfo(metadata["build-info"]));
21-
22-
const organization = organizations?.find((o) => o.name === organizationName);
2321
const provisionersQuery = useQuery(provisionerDaemonGroups(organizationName));
2422

2523
if (!organization) {

site/src/pages/ManagementSettingsPage/OrganizationSettingsPage.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,7 @@ const OrganizationSettingsPage: FC = () => {
5555
// .find will stop at the first match found; make sure default
5656
// organizations are placed first
5757
const editableOrg = [...organizations]
58-
.sort((a, b) => {
59-
if (a.is_default && !b.is_default) {
60-
return -1;
61-
}
62-
if (b.is_default && !a.is_default) {
63-
return 1;
64-
}
65-
return 0;
66-
})
58+
.sort((a, b) => (b.is_default ? 1 : 0) - (a.is_default ? 1 : 0))
6759
.find((org) => canEditOrganization(permissions[org.id]));
6860
if (editableOrg) {
6961
return <Navigate to={`/organizations/${editableOrg.name}`} replace />;

0 commit comments

Comments
 (0)