Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
Fix teamInfo guards and Skeleton key props in hidden documents components
Cursor Agent1405ed66d538
diff --git a/components/documents/hidden-document-card.tsx b/components/documents/hidden-document-card.tsxindex c689c918..de316078 100644--- a/components/documents/hidden-document-card.tsx+++ b/components/documents/hidden-document-card.tsx@@ -86,15 +86,21 @@ export function HiddenDocumentCard({return;}+ const teamId = teamInfo?.currentTeam?.id;+ if (!teamId) {+ toast.error("Team information is missing. Please try again.");+ return;+ }+toast.promise(- fetch(`/api/teams/${teamInfo?.currentTeam?.id}/documents/${documentId}`, {+ fetch(`/api/teams/${teamId}/documents/${documentId}`, {method: "DELETE",}).then(async (res) => {if (!res.ok) {const error = await res.json();throw new Error(error.message || "Failed to delete document");}- mutate(`/api/teams/${teamInfo?.currentTeam?.id}/documents/hidden`);+ mutate(`/api/teams/${teamId}/documents/hidden`);}),{loading: "Deleting document...",@@ -124,8 +130,14 @@ export function HiddenDocumentCard({event.stopPropagation();event.preventDefault();+ const teamId = teamInfo?.currentTeam?.id;+ if (!teamId) {+ toast.error("Team information is missing. Please try again.");+ return;+ }+toast.promise(- fetch(`/api/teams/${teamInfo?.currentTeam?.id}/documents/hide`, {+ fetch(`/api/teams/${teamId}/documents/hide`, {method: "POST",headers: {"Content-Type": "application/json",@@ -139,9 +151,9 @@ export function HiddenDocumentCard({const error = await res.json();throw new Error(error.message || "Failed to unhide document");}- mutate(`/api/teams/${teamInfo?.currentTeam?.id}/documents/hidden`);- mutate(`/api/teams/${teamInfo?.currentTeam?.id}/documents`);- mutate(`/api/teams/${teamInfo?.currentTeam?.id}/folders?root=true`);+ mutate(`/api/teams/${teamId}/documents/hidden`);+ mutate(`/api/teams/${teamId}/documents`);+ mutate(`/api/teams/${teamId}/folders?root=true`);setMenuOpen(false);}),{diff --git a/components/documents/hidden-documents-list.tsx b/components/documents/hidden-documents-list.tsxindex eb7ab621..4688c06d 100644--- a/components/documents/hidden-documents-list.tsx+++ b/components/documents/hidden-documents-list.tsx@@ -308,15 +308,12 @@ export function HiddenDocumentsList({key={i}className="relative flex w-full items-center space-x-3 rounded-lg border px-4 py-5 sm:px-6 lg:px-6">- <Skeleton key={i} className="h-9 w-9" />+ <Skeleton className="h-9 w-9" /><div>- <Skeleton key={i} className="h-4 w-32" />- <Skeleton key={i + 1} className="mt-2 h-3 w-12" />+ <Skeleton className="h-4 w-32" />+ <Skeleton className="mt-2 h-3 w-12" /></div>- <Skeleton- key={i + 1}- className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform"- />+ <Skeleton className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform" /></li>))}</ul>@@ -343,15 +340,12 @@ export function HiddenDocumentsList({key={i}className="relative flex w-full items-center space-x-3 rounded-lg border px-4 py-5 sm:px-6 lg:px-6">- <Skeleton key={i} className="h-9 w-9" />+ <Skeleton className="h-9 w-9" /><div>- <Skeleton key={i} className="h-4 w-32" />- <Skeleton key={i + 1} className="mt-2 h-3 w-12" />+ <Skeleton className="h-4 w-32" />+ <Skeleton className="mt-2 h-3 w-12" /></div>- <Skeleton- key={i + 1}- className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform"- />+ <Skeleton className="absolute right-5 top-[50%] h-5 w-20 -translate-y-[50%] transform" /></li>))}</ul>