mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-20 23:21:06 +02:00
researcher page work
This commit is contained in:
parent
50562be76f
commit
df665a0424
3 changed files with 49 additions and 31 deletions
|
|
@ -45,12 +45,19 @@ const DocumentSelector = React.memo(
|
|||
// Calculate skip value for pagination
|
||||
const skip = pageIndex * pageSize;
|
||||
|
||||
const { documents, loading, isLoaded, fetchDocuments } = useDocuments(
|
||||
Number(search_space_id),
|
||||
true,
|
||||
skip,
|
||||
pageSize
|
||||
);
|
||||
const { documents, loading, isLoaded, fetchDocuments, error } = useDocuments(
|
||||
Number(search_space_id),
|
||||
true,
|
||||
skip,
|
||||
pageSize
|
||||
);
|
||||
|
||||
// Refetch documents when pagination changes
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
fetchDocuments();
|
||||
}
|
||||
}, [skip, pageSize, isOpen, fetchDocuments]);
|
||||
|
||||
const handleOpenChange = useCallback(
|
||||
(open: boolean) => {
|
||||
|
|
@ -105,6 +112,15 @@ const DocumentSelector = React.memo(
|
|||
<p className="text-sm text-muted-foreground">Loading documents...</p>
|
||||
</div>
|
||||
</div>
|
||||
) : error ? (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="text-center space-y-2">
|
||||
<p className="text-sm text-destructive">Error loading documents: {error}</p>
|
||||
<Button onClick={fetchDocuments} variant="outline" size="sm">
|
||||
Retry
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : isLoaded ? (
|
||||
<DocumentsDataTable
|
||||
documents={documents}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue