mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-10 20:35:17 +02:00
fix: handle error states from useQuery in DocumentsTable
This commit is contained in:
parent
b8d629da71
commit
8140a5fb6e
1 changed files with 3 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ export default function DocumentsTable() {
|
|||
data: documentsResponse,
|
||||
isLoading: isDocumentsLoading,
|
||||
refetch: refetchDocuments,
|
||||
error : documentsError
|
||||
} = useQuery({
|
||||
queryKey: cacheKeys.documents.globalQueryParams(queryParams),
|
||||
queryFn: () => documentsApiService.getDocuments({ queryParams }),
|
||||
|
|
@ -90,6 +91,7 @@ export default function DocumentsTable() {
|
|||
data: searchResponse,
|
||||
isLoading: isSearchLoading,
|
||||
refetch: refetchSearch,
|
||||
error: searchError
|
||||
} = useQuery({
|
||||
queryKey: cacheKeys.documents.globalQueryParams(searchQueryParams),
|
||||
queryFn: () => documentsApiService.searchDocuments({ queryParams: searchQueryParams }),
|
||||
|
|
@ -105,10 +107,10 @@ export default function DocumentsTable() {
|
|||
? searchResponse?.total || 0
|
||||
: documentsResponse?.total || 0;
|
||||
const loading = debouncedSearch.trim() ? isSearchLoading : isDocumentsLoading;
|
||||
const error = debouncedSearch.trim() ? searchError : documentsError
|
||||
|
||||
// Use server-side pagination, search, and filtering
|
||||
const {
|
||||
error,
|
||||
deleteDocument,
|
||||
} = useDocuments(searchSpaceId, {
|
||||
page: pageIndex,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue