diff --git a/frontend/src/documents/DocumentsTable.jsx b/frontend/src/documents/DocumentsTable.jsx
index e086533..322daf4 100644
--- a/frontend/src/documents/DocumentsTable.jsx
+++ b/frontend/src/documents/DocumentsTable.jsx
@@ -203,6 +203,7 @@ const DocumentsTable = ({
subfolders,
documents,
searchResults,
+ isFilterActive = false,
onFolderSelect,
onFolderDrop,
onFolderDragOver,
@@ -473,11 +474,10 @@ const DocumentsTable = ({
[activeCorrespondentIdSet, onCorrespondentClick],
);
- const showDefaultEmptyState = !showingSearchResults && !subfolders.length && rows.length === 0;
- const showListSearchEmptyState =
- showingSearchResults && rows.length === 0 && !isGridView && !isSearchLoading;
- const showGridSearchEmptyState =
- isGridView && showingSearchResults && rows.length === 0 && !isSearchLoading;
+ const noResults = rows.length === 0;
+ const showDefaultEmptyState = !showingSearchResults && !isFilterActive && !subfolders.length && noResults;
+ const showListSearchEmptyState = showingSearchResults && noResults && !isGridView && !isSearchLoading;
+ const showGridSearchEmptyState = isGridView && showingSearchResults && noResults && !isSearchLoading;
const showSearchHint = showingSearchResults && rows.length > 0;
const breadcrumbEntries = useMemo(() => (Array.isArray(breadcrumbs) ? breadcrumbs.filter(Boolean) : []), [breadcrumbs]);
const trailEntries = useMemo(() => {
@@ -548,41 +548,48 @@ const DocumentsTable = ({
) : null}
- {showDefaultEmptyState && (
-
- Drop files anywhere or onto a folder to upload documents.
+ {showDefaultEmptyState ? (
+
+
+ Drop files anywhere or onto a folder to upload documents.
+
- )}
- {showGridSearchEmptyState && (
-
- No documents match the current filters.
+ ) : showGridSearchEmptyState ? (
+
+
+ No documents match the current filters.
+
- )}
-
-
{
- if (event.target === scrollRef.current) {
- onDocumentListFocus?.();
- }
- }}
- onKeyDown={(event) => {
- if (event.target !== scrollRef.current) {
- return;
- }
- if (onDocumentListKeyDown) {
- onDocumentListKeyDown(event);
- }
- }}
- onClick={(event) => {
- if (event.target === event.currentTarget) {
- onClearSelection?.();
- }
- }}
- aria-activedescendant={isGridView ? undefined : activeDescendantId}
- >
- {showDefaultEmptyState ? null : isGridView ? (
+ ) : showListSearchEmptyState ? (
+
+
No documents match the current filters.
+
+ ) : (
+
+
{
+ if (event.target === scrollRef.current) {
+ onDocumentListFocus?.();
+ }
+ }}
+ onKeyDown={(event) => {
+ if (event.target !== scrollRef.current) {
+ return;
+ }
+ if (onDocumentListKeyDown) {
+ onDocumentListKeyDown(event);
+ }
+ }}
+ onClick={(event) => {
+ if (event.target === event.currentTarget) {
+ onClearSelection?.();
+ }
+ }}
+ aria-activedescendant={isGridView ? undefined : activeDescendantId}
+ >
+ {isGridView ? (
- ) : (
+ ) : noResults ? null : (
@@ -1060,15 +1067,13 @@ const DocumentsTable = ({
)}
- {showListSearchEmptyState && (
-
No documents match the current filters.
- )}
{showSearchHint && (
Showing {rows.length} document{rows.length === 1 ? '' : 's'} in {currentFolderName} and subfolders.
)}
-
+
+ )}
);
};