diff --git a/frontend/src/documents/DocumentsTable.jsx b/frontend/src/documents/DocumentsTable.jsx
index 39ea0b0..cb37f18 100644
--- a/frontend/src/documents/DocumentsTable.jsx
+++ b/frontend/src/documents/DocumentsTable.jsx
@@ -70,6 +70,7 @@ const DocumentsTable = ({
getDocumentAsset = () => null,
getDownloadHref,
onTagClick,
+ isSearchLoading = false,
}) => {
const showingSearchResults = searchResults !== null;
const rows = showingSearchResults ? searchResults : documents;
@@ -453,7 +454,7 @@ const DocumentsTable = ({
)}
- {rows.length === 0 && isFilterActive && (
+ {rows.length === 0 && showingSearchResults && !isSearchLoading && (
No documents match the current filters.
)}
{showingSearchResults && rows.length > 0 && (
diff --git a/frontend/src/index.jsx b/frontend/src/index.jsx
index 49370c3..e8b616f 100644
--- a/frontend/src/index.jsx
+++ b/frontend/src/index.jsx
@@ -430,6 +430,7 @@ const AppLayout = () => {
setSearchQuery('');
setActiveTagFilters([]);
setActiveCorrespondentFilters([]);
+ setSearchLoading(false);
}, []);
const handleSearchSubmit = useCallback(() => {
@@ -449,6 +450,7 @@ const AppLayout = () => {
const [activePreviewId, setActivePreviewId] = useState(routeDocumentId || null);
const [previewDocumentId, setPreviewDocumentId] = useState(null);
const [previewDocumentLoading, setPreviewDocumentLoading] = useState(false);
+ const [searchLoading, setSearchLoading] = useState(false);
const shellRef = useRef(null);
const assetManagerRef = useRef(null);
if (!assetManagerRef.current) {
@@ -3644,11 +3646,13 @@ const AppLayout = () => {
if (!isFilterActive) {
setSearchResults(null);
+ setSearchLoading(false);
return undefined;
}
let cancelled = false;
let started = false;
+ setSearchLoading(true);
const debounce = setTimeout(async () => {
started = true;
@@ -3676,6 +3680,7 @@ const AppLayout = () => {
setSearchResults(results);
if (!results.length) {
+ setSearchLoading(false);
setSelectedRowKeys([]);
setFocusedDocumentId(null);
selectionOrderRef.current = [];
@@ -3726,6 +3731,7 @@ const AppLayout = () => {
} finally {
if (!cancelled && started) {
setLoading(false);
+ setSearchLoading(false);
}
}
}, 300);
@@ -3735,6 +3741,7 @@ const AppLayout = () => {
clearTimeout(debounce);
if (started) {
setLoading(false);
+ setSearchLoading(false);
}
};
}, [
@@ -3878,9 +3885,6 @@ const AppLayout = () => {
notifyApiError(error, 'Failed to load folder.');
}
}
- if (folderId === 'root') {
- return;
- }
setFolderNodes((prev) => {
const next = new Map(prev);
const current = next.get(folderId);
@@ -4312,6 +4316,7 @@ const AppLayout = () => {
draggingDocumentIds: draggedDocumentIds,
onDocumentDragStart: handleDocumentDragStart,
onDocumentDragEnd: handleDocumentDragEnd,
+ isSearchLoading: searchLoading,
tagLookupById,
onDocumentListFocus: handleDocumentListFocus,
onDocumentListKeyDown: handleDocumentListKeyDown,