added support for multi select sources

This commit is contained in:
Ankit Matth
2025-08-16 15:19:19 +05:30
parent 6a02bcf15b
commit 6f47aa802b
7 changed files with 115 additions and 69 deletions

View File

@@ -18,11 +18,11 @@ export default function useDefaultDocument() {
const fetchDocs = () => {
getDocs(token).then((data) => {
dispatch(setSourceDocs(data));
if (!selectedDoc)
if (!selectedDoc || (Array.isArray(selectedDoc) && selectedDoc.length === 0))
Array.isArray(data) &&
data?.forEach((doc: Doc) => {
if (doc.model && doc.name === 'default') {
dispatch(setSelectedDocs(doc));
dispatch(setSelectedDocs([doc]));
}
});
});