fix: upon successful training of newly uploaded src doc, the latest doc is auto set as selected doc

This commit is contained in:
utin-francis-peter
2024-06-19 23:41:38 +01:00
parent 2fbec6f21f
commit 45145685d5

View File

@@ -104,7 +104,14 @@ export default function Upload({
.then((data) => {
if (data.status == 'SUCCESS') {
if (data.result.limited === true) {
getDocs().then((data) => dispatch(setSourceDocs(data)));
getDocs().then((data) => {
dispatch(setSourceDocs(data));
dispatch(
setSelectedDocs(
data?.find((d) => d.location.toLowerCase() === 'local'),
),
);
});
setProgress(
(progress) =>
progress && {
@@ -114,7 +121,14 @@ export default function Upload({
},
);
} else {
getDocs().then((data) => dispatch(setSourceDocs(data)));
getDocs().then((data) => {
dispatch(setSourceDocs(data));
dispatch(
setSelectedDocs(
data?.find((d) => d.location.toLowerCase() === 'local'),
),
);
});
setProgress(
(progress) =>
progress && {