fix some bugs with selecting an org
All checks were successful
Deploy / deploy (ubuntu-latest, 2.44.0) (push) Successful in 56s

This commit is contained in:
Braydon 2024-09-19 00:42:45 -04:00
parent 2a1cfa4994
commit c92ab6d41c

@ -44,11 +44,21 @@ const OrganizationSelector = (): ReactElement => {
// Set the selected organization
useEffect(() => {
setSelected(
organizations.find((organization: Organization) => {
const toSelect: Organization | undefined = organizations.find(
(organization: Organization) => {
return organization.snowflake === selectedOrganization;
})
}
);
// Update the state for this page
setSelected(
toSelect ||
(organizations.length > 0 ? organizations[0] : undefined)
);
// Update the state for all pages
if (!toSelect && organizations.length > 0) {
setSelectedOrganization(organizations[0].snowflake);
}
}, [organizations, selectedOrganization]);
/**