"use client"; import { observer } from "mobx-react"; import useSWR from "swr"; // components import { LogoSpinner } from "@/components/common/logo-spinner"; import { PoweredBy } from "@/components/common/powered-by"; import { SomethingWentWrongError } from "@/components/issues/issue-layouts/error"; // hooks import { usePublish, usePublishList } from "@/hooks/store/publish"; // Plane web import { ViewNavbarRoot } from "@/plane-web/components/navbar"; import { useView } from "@/plane-web/hooks/store"; type Props = { children: React.ReactNode; params: { anchor: string; }; }; const ViewsLayout = observer((props: Props) => { const { children, params } = props; // params const { anchor } = params; // store hooks const { fetchPublishSettings } = usePublishList(); const { viewData, fetchViewDetails } = useView(); const publishSettings = usePublish(anchor); // fetch publish settings && view details const { error } = useSWR( anchor ? `PUBLISHED_VIEW_SETTINGS_${anchor}` : null, anchor ? async () => { const promises = []; promises.push(fetchPublishSettings(anchor)); promises.push(fetchViewDetails(anchor)); await Promise.all(promises); } : null ); if (error) return ; if (!publishSettings || !viewData) { return (
); } return (
{children}
); }); export default ViewsLayout;