Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: use hooks condition error

Marc Seitz43036049c28a
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index e478a743..bdb53089 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -334,7 +334,7 @@ export default function LinkSheet({
onClick={async (e) => {
e.stopPropagation();
e.preventDefault();
- mutateGroups && (await mutateGroups());
+ await mutateGroups();
}}
>
<RefreshCwIcon className="h-4 w-4" />
diff --git a/lib/swr/use-dataroom-groups.ts b/lib/swr/use-dataroom-groups.ts
index 08d2accf..6641e734 100644
--- a/lib/swr/use-dataroom-groups.ts
+++ b/lib/swr/use-dataroom-groups.ts
@@ -12,13 +12,10 @@ import useSWR from "swr";
import { fetcher } from "@/lib/utils";
export default function useDataroomGroups() {
- // if not on dataroom page, return
+ const teamInfo = useTeam();
const router = useRouter();
- const isDataroom = router.pathname.includes("datarooms");
- if (!isDataroom)
- return { viewerGroups: [], loading: false, error: null, mutate: null };
- const teamInfo = useTeam();
+ const isDataroom = router.pathname.includes("datarooms");
const { id } = router.query as {
id: string;
};
@@ -37,6 +34,7 @@ export default function useDataroomGroups() {
} = useSWR<ViewerGroupWithCount[]>(
teamInfo?.currentTeam?.id &&
id &&
+ isDataroom &&
`/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${id}/groups`,
fetcher,
{ dedupingInterval: 30000 },