lazy loading fix for useDocument

This commit is contained in:
Utkarsh-Patel-13 2025-07-22 17:02:18 -07:00
parent cf162101a6
commit d8797b4f71
2 changed files with 3 additions and 2 deletions

View file

@ -42,7 +42,8 @@ const DocumentSelector = React.memo(
const [isOpen, setIsOpen] = useState(false);
const { documents, loading, isLoaded, fetchDocuments } = useDocuments(
Number(search_space_id)
Number(search_space_id),
true
);
const handleOpenChange = useCallback(

View file

@ -23,7 +23,7 @@ export type DocumentType =
| "LINEAR_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 [loading, setLoading] = useState(!lazy); // Don't show loading initially for lazy mode
const [error, setError] = useState<string | null>(null);