Skip to content

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

fix: `useTeam()` hook called at the top

Aashish-Upadhyay-101c89e44179a83
diff --git a/components/PDFViewer.tsx b/components/PDFViewer.tsx
index a15c8d9f..bf0a0831 100644
--- a/components/PDFViewer.tsx
+++ b/components/PDFViewer.tsx
@@ -14,6 +14,7 @@ export default function PDFViewer(props: any) {
const startTimeRef = useRef(Date.now());
const pageNumberRef = useRef<number>(pageNumber);
+ const teamInfo = useTeam();
// Update the previous page number after the effect hook has run
useEffect(() => {
@@ -118,8 +119,6 @@ export default function PDFViewer(props: any) {
}
async function updateNumPages(numPages: number) {
- const teamInfo = useTeam();
-
await fetch(`/api/teams/${teamInfo?.currentTeam?.id}/documents/update`, {
method: "POST",
body: JSON.stringify({