fix(plugin-workflow): clear options when change collection (#547)

This commit is contained in:
Junyi 2022-06-28 18:48:16 +08:00 committed by GitHub
parent 4a8c9c8d87
commit fdb7b4c664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

2
.vscode/launch.json vendored
View File

@ -33,7 +33,7 @@
"test",
"--runInBand",
// could be any single file path to debug
"${workspaceFolder}/packages/"
"${workspaceFolder}/packages/plugins/workflow/src/__tests__/instructions/parallel.test.ts"
],
"port": 9229,
"skipFiles": [

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Select } from 'antd';
import { observer, useForm } from '@formily/react';
import { observer, useForm, useFormEffects } from '@formily/react';
import { useCollectionDataSource, useCollectionManager } from '../../collection-manager';
import { useCompile } from '../../schema-component';
@ -10,12 +10,19 @@ import { BaseTypeSet } from '../calculators';
import { collection, filter } from '../schemas/collection';
import { useTranslation } from 'react-i18next';
import { css } from '@emotion/css';
import { onFieldValueChange } from '@formily/core';
const FieldsSelect = observer((props) => {
const compile = useCompile();
const { getCollectionFields } = useCollectionManager();
const { values } = useForm();
const { values, clearFormGraph, setValuesIn } = useForm();
const fields = getCollectionFields(values?.config?.collection);
useFormEffects(() => {
onFieldValueChange('config.collection', (field) => {
clearFormGraph('config.changed');
setValuesIn('config.condition', null);
});
});
return (
<Select

View File

@ -160,7 +160,7 @@ export const ScheduleConfig = () => {
clearFormGraph('config.repeat');
clearFormGraph('config.endsOn');
clearFormGraph('config.limit');
})
});
});
return (