Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(console): fix loading and error handling for org details page #6313

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions packages/console/src/pages/OrganizationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ import useSWR from 'swr';
import Delete from '@/assets/icons/delete.svg';
import File from '@/assets/icons/file.svg';
import OrganizationIcon from '@/assets/icons/organization-preview.svg';
import AppError from '@/components/AppError';
import DetailsPage from '@/components/DetailsPage';
import DetailsPageHeader from '@/components/DetailsPage/DetailsPageHeader';
import Skeleton from '@/components/DetailsPage/Skeleton';
import Drawer from '@/components/Drawer';
import PageMeta from '@/components/PageMeta';
import ThemedIcon from '@/components/ThemedIcon';
Expand All @@ -31,7 +29,6 @@ import { OrganizationDetailsTabs, type OrganizationDetailsOutletContext } from '

const pathname = '/organizations';

// eslint-disable-next-line complexity
function OrganizationDetails() {
const { id } = useParams();
const { navigate } = useTenantPathname();
Expand Down Expand Up @@ -70,14 +67,19 @@ function OrganizationDetails() {
(!jitEmailDomains.data && !jitEmailDomains.error) ||
(!jitRoles.data && !jitRoles.error) ||
(!jitSsoConnectors.data && !jitSsoConnectors.error);

const error =
organization.error ?? jitEmailDomains.error ?? jitRoles.error ?? jitSsoConnectors.error;

return (
<DetailsPage backLink={pathname} backLinkTitle="organizations.title" className={styles.page}>
<DetailsPage
backLink={pathname}
backLinkTitle="organizations.title"
className={styles.page}
isLoading={isLoading}
error={error}
>
<PageMeta titleKey="organization_details.page_title" />
{isLoading && <Skeleton />}
xiaoyijun marked this conversation as resolved.
Show resolved Hide resolved
{error && <AppError errorCode={error.body?.code} errorMessage={error.body?.message} />}
{id &&
organization.data &&
jitEmailDomains.data &&
Expand Down
Loading