fix project issue loader and error handling (#5223)

This commit is contained in:
rahulramesha 2024-07-25 14:15:16 +05:30 committed by GitHub
parent 1bf8f82ccb
commit c2c2ad0d7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 39 deletions

View file

@ -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 <LogoSpinner />;
if (!publishSettings && !error) return <LogoSpinner />;
if (error) return <SomethingWentWrongError />;
return (
<div className="relative flex h-screen min-h-[500px] w-screen flex-col overflow-hidden">