fix: deduplicate in select provider models and target models
This commit is contained in:
@@ -65,8 +65,13 @@ const ModelRoutes: React.FC = () => {
|
||||
const { watchDataList: allRouteTargets, deleteItemFromCache } =
|
||||
useWatchList(MODEL_ROUTE_TARGETS);
|
||||
const [expandAtom] = useAtom(expandKeysAtom);
|
||||
const { handleExpandChange, handleExpandAll, expandedRowKeys } =
|
||||
useExpandedRowKeys(expandAtom);
|
||||
const {
|
||||
handleExpandChange,
|
||||
handleExpandAll,
|
||||
updateExpandedRowKeys,
|
||||
removeExpandedRowKey,
|
||||
expandedRowKeys
|
||||
} = useExpandedRowKeys(expandAtom);
|
||||
const intl = useIntl();
|
||||
const { openRouteModalStatus, openRouteModal, closeRouteModal } =
|
||||
useCreateRoute();
|
||||
@@ -109,17 +114,22 @@ const ModelRoutes: React.FC = () => {
|
||||
...data
|
||||
};
|
||||
try {
|
||||
let data: ListItem = {} as any;
|
||||
if (openRouteModalStatus.action === PageAction.EDIT) {
|
||||
await updateModelRoute({
|
||||
data = await updateModelRoute({
|
||||
data: params,
|
||||
id: openRouteModalStatus.currentData!.id
|
||||
});
|
||||
}
|
||||
if (openRouteModalStatus.action === PageAction.CREATE) {
|
||||
await createModelRoute({
|
||||
data = await createModelRoute({
|
||||
data: params
|
||||
});
|
||||
}
|
||||
|
||||
if (data.targets > 0) {
|
||||
updateExpandedRowKeys([data.id, ...expandedRowKeys]);
|
||||
}
|
||||
fetchData();
|
||||
closeRouteModal();
|
||||
message.success(intl.formatMessage({ id: 'common.message.success' }));
|
||||
|
||||
Reference in New Issue
Block a user