Skip to content

Commit

Permalink
AssistantBuilderDataSourceModal: return to list of datasource when cl…
Browse files Browse the repository at this point in the history
…osing selector
  • Loading branch information
spolu committed Jan 24, 2024
1 parent 67806b9 commit 7afa81e
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
ChevronLeftIcon,
CloudArrowDownIcon,
CloudArrowLeftRightIcon,
Item,
Expand Down Expand Up @@ -50,12 +51,16 @@ export default function AssistantBuilderDataSourceModal({
}
}, [dataSourceToManage]);

const onReset = () => {
setSelectedDataSource(null);
setSelectedResources({});
setIsSelectAll(false);
};

const onClose = () => {
setOpen(false);
setTimeout(() => {
setSelectedDataSource(null);
setSelectedResources({});
setIsSelectAll(false);
onReset();
}, 200);
};

Expand All @@ -77,7 +82,7 @@ export default function AssistantBuilderDataSourceModal({
return (
<Modal
isOpen={isOpen}
onClose={onClose}
onClose={selectedDataSource && !dataSourceToManage ? onReset : onClose}
onSave={() => onSaveLocal({ isSelectAll })}
hasChanged={
!!selectedDataSource &&
Expand Down

0 comments on commit 7afa81e

Please sign in to comment.