diff --git a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx
index 464bac471..6ab96b920 100644
--- a/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx
+++ b/surfsense_web/app/dashboard/[search_space_id]/documents/(manage)/components/DocumentsTableShell.tsx
@@ -540,14 +540,10 @@ export function DocumentsTableShell({
).length;
const failCount = deletableSelectedIds.length - successCount;
if (successCount > 0) {
- toast.success(
- `Deleted ${successCount} document${successCount !== 1 ? "s" : ""}`
- );
+ toast.success(`Deleted ${successCount} document${successCount !== 1 ? "s" : ""}`);
}
if (failCount > 0) {
- toast.error(
- `Failed to delete ${failCount} document${failCount !== 1 ? "s" : ""}`
- );
+ toast.error(`Failed to delete ${failCount} document${failCount !== 1 ? "s" : ""}`);
}
}
} catch {
@@ -561,58 +557,56 @@ export function DocumentsTableShell({
{/* Desktop Table View */}
-
-
-
-
-
- toggleAll(!!v)}
- aria-label={hasChatMode ? "Toggle all for chat" : "Select all"}
- className="border-foreground data-[state=checked]:bg-primary data-[state=checked]:border-primary"
- />
-
-
-
- }
- >
- Document
-
-
-
-
-
-
-
-
- {hasDeletableSelection ? (
-
-
-
-
-
- Delete {deletableSelectedIds.length} selected
-
-
- ) : (
- Status
- )}
-
-
-
-
+
+
+
+
+
+ toggleAll(!!v)}
+ aria-label={hasChatMode ? "Toggle all for chat" : "Select all"}
+ className="border-foreground data-[state=checked]:bg-primary data-[state=checked]:border-primary"
+ />
+
+
+
+ }
+ >
+ Document
+
+
+
+
+
+
+
+
+ {hasDeletableSelection ? (
+
+
+
+
+ Delete {deletableSelectedIds.length} selected
+
+ ) : (
+ Status
+ )}
+
+
+
+
{loading ? (
@@ -683,50 +677,50 @@ export function DocumentsTableShell({
- {sorted.map((doc) => {
- const isMentioned = mentionedDocIds?.has(doc.id) ?? false;
- const canInteract = isSelectable(doc);
- const handleRowToggle = () => {
- if (canInteract && onToggleChatMention) {
- onToggleChatMention(doc, isMentioned);
- }
- };
- const handleRowClick = (e: React.MouseEvent) => {
- if (e.ctrlKey || e.metaKey) {
- e.preventDefault();
- e.stopPropagation();
- handleViewMetadata(doc);
- return;
- }
- handleRowToggle();
- };
- return (
-
- {
+ const isMentioned = mentionedDocIds?.has(doc.id) ?? false;
+ const canInteract = isSelectable(doc);
+ const handleRowToggle = () => {
+ if (canInteract && onToggleChatMention) {
+ onToggleChatMention(doc, isMentioned);
+ }
+ };
+ const handleRowClick = (e: React.MouseEvent) => {
+ if (e.ctrlKey || e.metaKey) {
+ e.preventDefault();
+ e.stopPropagation();
+ handleViewMetadata(doc);
+ return;
+ }
+ handleRowToggle();
+ };
+ return (
+
+
e.stopPropagation()}
>
- handleRowToggle()}
- disabled={!canInteract}
- aria-label={isMentioned ? "Remove from chat" : "Add to chat"}
- className={`border-foreground data-[state=checked]:bg-primary data-[state=checked]:border-primary ${!canInteract ? "opacity-40 cursor-not-allowed" : ""}`}
- />
+ handleRowToggle()}
+ disabled={!canInteract}
+ aria-label={isMentioned ? "Remove from chat" : "Add to chat"}
+ className={`border-foreground data-[state=checked]:bg-primary data-[state=checked]:border-primary ${!canInteract ? "opacity-40 cursor-not-allowed" : ""}`}
+ />
diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
index 69452a53b..4e167b2e4 100644
--- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
+++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
@@ -83,7 +83,11 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
// Atoms
const { data: user } = useAtomValue(currentUserAtom);
- const { data: searchSpacesData, refetch: refetchSearchSpaces, isSuccess: searchSpacesLoaded } = useAtomValue(searchSpacesAtom);
+ const {
+ data: searchSpacesData,
+ refetch: refetchSearchSpaces,
+ isSuccess: searchSpacesLoaded,
+ } = useAtomValue(searchSpacesAtom);
const { mutateAsync: deleteSearchSpace } = useAtomValue(deleteSearchSpaceMutationAtom);
const currentThreadState = useAtomValue(currentThreadAtom);
const resetCurrentThread = useSetAtom(resetCurrentThreadAtom);
@@ -279,13 +283,22 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
// Safety redirect: if the current search space is no longer in the user's list
// (e.g. deleted by background task, membership revoked), redirect to a valid space.
useEffect(() => {
- if (!searchSpacesLoaded || !searchSpaceId || isDeletingSearchSpace || isLeavingSearchSpace) return;
+ if (!searchSpacesLoaded || !searchSpaceId || isDeletingSearchSpace || isLeavingSearchSpace)
+ return;
if (searchSpaces.length > 0 && !activeSearchSpace) {
router.replace(`/dashboard/${searchSpaces[0].id}/new-chat`);
} else if (searchSpaces.length === 0 && searchSpacesLoaded) {
router.replace("/dashboard");
}
- }, [searchSpacesLoaded, searchSpaceId, searchSpaces, activeSearchSpace, isDeletingSearchSpace, isLeavingSearchSpace, router]);
+ }, [
+ searchSpacesLoaded,
+ searchSpaceId,
+ searchSpaces,
+ activeSearchSpace,
+ isDeletingSearchSpace,
+ isLeavingSearchSpace,
+ router,
+ ]);
// Transform and split chats into private and shared based on visibility
const { myChats, sharedChats } = useMemo(() => {
@@ -400,9 +413,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
// Await refetch so we have the freshest list (backend now hides [DELETING] spaces)
const result = await refetchSearchSpaces();
- const updatedSpaces = (result.data ?? []).filter(
- (s) => s.id !== searchSpaceToDelete.id
- );
+ const updatedSpaces = (result.data ?? []).filter((s) => s.id !== searchSpaceToDelete.id);
if (isCurrentSpace) {
if (updatedSpaces.length > 0) {
@@ -421,14 +432,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
setShowDeleteSearchSpaceDialog(false);
setSearchSpaceToDelete(null);
}
- }, [
- searchSpaceToDelete,
- deleteSearchSpace,
- refetchSearchSpaces,
- searchSpaceId,
- router,
- t,
- ]);
+ }, [searchSpaceToDelete, deleteSearchSpace, refetchSearchSpaces, searchSpaceId, router, t]);
const confirmLeaveSearchSpace = useCallback(async () => {
if (!searchSpaceToLeave) return;
@@ -439,9 +443,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
const isCurrentSpace = Number(searchSpaceId) === searchSpaceToLeave.id;
const result = await refetchSearchSpaces();
- const updatedSpaces = (result.data ?? []).filter(
- (s) => s.id !== searchSpaceToLeave.id
- );
+ const updatedSpaces = (result.data ?? []).filter((s) => s.id !== searchSpaceToLeave.id);
if (isCurrentSpace) {
if (updatedSpaces.length > 0) {
diff --git a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
index 72b92fc55..05cfb890a 100644
--- a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
@@ -148,7 +148,14 @@ export function DocumentsSidebar({
return false;
}
},
- [deleteDocumentMutation, isSearchMode, t, searchRemoveItems, realtimeRemoveItems, setSidebarDocs]
+ [
+ deleteDocumentMutation,
+ isSearchMode,
+ t,
+ searchRemoveItems,
+ realtimeRemoveItems,
+ setSidebarDocs,
+ ]
);
const handleBulkDeleteDocuments = useCallback(
diff --git a/surfsense_web/instrumentation-client.ts b/surfsense_web/instrumentation-client.ts
index 20d370c4e..31a4e620e 100644
--- a/surfsense_web/instrumentation-client.ts
+++ b/surfsense_web/instrumentation-client.ts
@@ -10,8 +10,8 @@ function initPostHog() {
defaults: "2025-11-30",
capture_pageview: "history_change",
capture_pageleave: true,
- before_send: (event) => {
- if (event?.properties) {
+ before_send: (event) => {
+ if (event?.properties) {
const params = new URLSearchParams(window.location.search);
const ref = params.get("ref");
if (ref) {