mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-02 18:49:09 +00:00
lazy loading fix for useDocument
This commit is contained in:
parent
cf162101a6
commit
d8797b4f71
2 changed files with 3 additions and 2 deletions
|
@ -42,7 +42,8 @@ const DocumentSelector = React.memo(
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
|
||||||
const { documents, loading, isLoaded, fetchDocuments } = useDocuments(
|
const { documents, loading, isLoaded, fetchDocuments } = useDocuments(
|
||||||
Number(search_space_id)
|
Number(search_space_id),
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleOpenChange = useCallback(
|
const handleOpenChange = useCallback(
|
||||||
|
|
|
@ -23,7 +23,7 @@ export type DocumentType =
|
||||||
| "LINEAR_CONNECTOR"
|
| "LINEAR_CONNECTOR"
|
||||||
| "DISCORD_CONNECTOR";
|
| "DISCORD_CONNECTOR";
|
||||||
|
|
||||||
export function useDocuments(searchSpaceId: number, lazy: boolean = true) {
|
export function useDocuments(searchSpaceId: number, lazy: boolean = false) {
|
||||||
const [documents, setDocuments] = useState<Document[]>([]);
|
const [documents, setDocuments] = useState<Document[]>([]);
|
||||||
const [loading, setLoading] = useState(!lazy); // Don't show loading initially for lazy mode
|
const [loading, setLoading] = useState(!lazy); // Don't show loading initially for lazy mode
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue