Skip to content

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

fix

Marc Seitzc20ff4fec2e9
diff --git a/ee/features/permissions/components/dataroom-link-sheet.tsx b/ee/features/permissions/components/dataroom-link-sheet.tsx
index 968e32c3..828c5d8c 100644
--- a/ee/features/permissions/components/dataroom-link-sheet.tsx
+++ b/ee/features/permissions/components/dataroom-link-sheet.tsx
@@ -299,13 +299,28 @@ export function DataroomLinkSheet({
// Handle permissions
if (permissions === null && isUpdating && currentLink?.permissionGroupId) {
// Delete the permission group - database will set permissionGroupId to null automatically
- await fetch(
+ const deleteResponse = await fetch(
`/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${targetId}/permission-groups/${currentLink.permissionGroupId}`,
{
method: "DELETE",
},
);
+ if (!deleteResponse.ok) {
+ // Handle error with toast message
+ try {
+ const errorData = await deleteResponse.json();
+ toast.error(errorData.error || "Failed to delete permission group");
+ } catch {
+ toast.error("Failed to delete permission group");
+ }
+ setIsSaving(false);
+ return;
+ }
+
+ // Show success message
+ toast.success("Permission group deleted successfully");
+
// Refresh the links cache
mutate(
`/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${encodeURIComponent(
@@ -313,9 +328,11 @@ export function DataroomLinkSheet({
)}/links`,
);
- // Invalidate the permission group cache
+ // Clear the permission group cache instead of invalidating to avoid 404
mutate(
`/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${targetId}/permission-groups/${currentLink.permissionGroupId}`,
+ undefined,
+ false,
);
} else if (permissions !== null) {
// Only handle permission group operations if we're not deleting