diff --git a/space/app/issues/[anchor]/layout.tsx b/space/app/issues/[anchor]/layout.tsx index 651facb8c89..ac5dba43078 100644 --- a/space/app/issues/[anchor]/layout.tsx +++ b/space/app/issues/[anchor]/layout.tsx @@ -6,6 +6,7 @@ import useSWR from "swr"; // components import { LogoSpinner } from "@/components/common"; import { IssuesNavbarRoot } from "@/components/issues"; +import { SomethingWentWrongError } from "@/components/issues/issue-layouts/error"; // hooks import { useIssueFilter, usePublish, usePublishList } from "@/hooks/store"; // assets @@ -27,7 +28,7 @@ const IssuesLayout = observer((props: Props) => { const publishSettings = usePublish(anchor); const { updateLayoutOptions } = useIssueFilter(); // fetch publish settings - useSWR( + const { error } = useSWR( anchor ? `PUBLISH_SETTINGS_${anchor}` : null, anchor ? async () => { @@ -45,7 +46,9 @@ const IssuesLayout = observer((props: Props) => { : null ); - if (!publishSettings) return ; + if (!publishSettings && !error) return ; + + if (error) return ; return (
diff --git a/space/core/components/issues/issue-layouts/error.tsx b/space/core/components/issues/issue-layouts/error.tsx new file mode 100644 index 00000000000..1b24a59cd60 --- /dev/null +++ b/space/core/components/issues/issue-layouts/error.tsx @@ -0,0 +1,17 @@ +import Image from "next/image"; +// assets +import SomethingWentWrongImage from "public/something-went-wrong.svg"; + +export const SomethingWentWrongError = () => ( +
+
+
+
+ Oops! Something went wrong +
+
+

Oops! Something went wrong.

+

The public board does not exist. Please check the URL.

+
+
+); diff --git a/space/core/components/issues/issue-layouts/root.tsx b/space/core/components/issues/issue-layouts/root.tsx index 73b9f326772..b487aff3a98 100644 --- a/space/core/components/issues/issue-layouts/root.tsx +++ b/space/core/components/issues/issue-layouts/root.tsx @@ -2,7 +2,6 @@ import { FC, useEffect } from "react"; import { observer } from "mobx-react"; -import Image from "next/image"; import useSWR from "swr"; // components import { IssueKanbanLayoutRoot, IssuesListLayoutRoot } from "@/components/issues"; @@ -13,7 +12,7 @@ import { useIssue, useIssueDetails, useIssueFilter } from "@/hooks/store"; // store import { PublishStore } from "@/store/publish/publish.store"; // assets -import SomethingWentWrongImage from "public/something-went-wrong.svg"; +import { SomethingWentWrongError } from "./error"; type Props = { peekId: string | undefined; @@ -24,7 +23,7 @@ export const IssuesLayoutsRoot: FC = observer((props) => { const { peekId, publishSettings } = props; // store hooks const { getIssueFilters } = useIssueFilter(); - const { loader, groupedIssueIds, fetchPublicIssues } = useIssue(); + const { fetchPublicIssues } = useIssue(); const issueDetailStore = useIssueDetails(); // derived values const { anchor } = publishSettings; @@ -48,46 +47,27 @@ export const IssuesLayoutsRoot: FC = observer((props) => { if (!anchor) return null; + if (error) return ; + return (
{peekId && } + {activeLayout && ( +
+ {/* applied filters */} + - {loader && !groupedIssueIds ? ( -
Loading...
- ) : ( - <> - {error ? ( -
-
-
-
- Oops! Something went wrong -
-
-

Oops! Something went wrong.

-

The public board does not exist. Please check the URL.

-
+ {activeLayout === "list" && ( +
+ +
+ )} + {activeLayout === "kanban" && ( +
+
- ) : ( - activeLayout && ( -
- {/* applied filters */} - - - {activeLayout === "list" && ( -
- -
- )} - {activeLayout === "kanban" && ( -
- -
- )} -
- ) )} - +
)}
);