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