fix view layout in space app (#5225)
This commit is contained in:
parent
1707f4f282
commit
1c155f6cbe
1 changed files with 11 additions and 13 deletions
|
|
@ -5,6 +5,7 @@ import Image from "next/image";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
// components
|
// components
|
||||||
import { LogoSpinner } from "@/components/common";
|
import { LogoSpinner } from "@/components/common";
|
||||||
|
import { SomethingWentWrongError } from "@/components/issues/issue-layouts/error";
|
||||||
// hooks
|
// hooks
|
||||||
import { usePublish, usePublishList } from "@/hooks/store";
|
import { usePublish, usePublishList } from "@/hooks/store";
|
||||||
// Plane web
|
// Plane web
|
||||||
|
|
@ -28,25 +29,22 @@ const IssuesLayout = observer((props: Props) => {
|
||||||
const { fetchPublishSettings } = usePublishList();
|
const { fetchPublishSettings } = usePublishList();
|
||||||
const { viewData, fetchViewDetails } = useView();
|
const { viewData, fetchViewDetails } = useView();
|
||||||
const publishSettings = usePublish(anchor);
|
const publishSettings = usePublish(anchor);
|
||||||
// fetch publish settings
|
|
||||||
useSWR(
|
// fetch publish settings && view details
|
||||||
anchor ? `PUBLISH_SETTINGS_${anchor}` : null,
|
const { error } = useSWR(
|
||||||
|
anchor ? `PUBLISHED_VIEW_SETTINGS_${anchor}` : null,
|
||||||
anchor
|
anchor
|
||||||
? async () => {
|
? async () => {
|
||||||
await fetchPublishSettings(anchor);
|
const promises = [];
|
||||||
}
|
promises.push(fetchPublishSettings(anchor));
|
||||||
: null
|
promises.push(fetchViewDetails(anchor));
|
||||||
);
|
await Promise.all(promises);
|
||||||
// fetch view data
|
|
||||||
useSWR(
|
|
||||||
anchor ? `VIEW_DETAILS_${anchor}` : null,
|
|
||||||
anchor
|
|
||||||
? async () => {
|
|
||||||
await fetchViewDetails(anchor);
|
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (error) return <SomethingWentWrongError />;
|
||||||
|
|
||||||
if (!publishSettings || !viewData) return <LogoSpinner />;
|
if (!publishSettings || !viewData) return <LogoSpinner />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue