Skip to content

Commit 072d6b7

Browse files
authored
fix: fix plugin datasource pane update when type changed (alibaba#65)
* fix: 切换新建数据源时,类型不刷新
1 parent 4ff5112 commit 072d6b7

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

packages/plugin-datasource-pane/src/components/DataSourceForm/DataSourceForm.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ const SCHEMA = {
4242
type: {
4343
title: '类型',
4444
type: 'string',
45-
editable: false,
4645
readOnly: true,
47-
hidden: true,
48-
display: 'hidden',
49-
visible: false,
5046
'x-decorator': 'FormItem',
5147
'x-component-props': {
5248
// labelWidth: 300,
@@ -199,8 +195,10 @@ export class DataSourceForm extends PureComponent<DataSourceFormProps, { form: F
199195
}
200196

201197
componentDidUpdate(prevProps: DataSourceFormProps) {
202-
// dataSource 变了,需要更新 form,界面刷新
203-
if (this.props.dataSource !== prevProps.dataSource) {
198+
const type = this.props.dataSourceType?.type;
199+
const ptype = prevProps.dataSourceType?.type;
200+
// dataSource 或 dataSourceType.type 变了,需要更新 form,界面刷新
201+
if (this.props.dataSource !== prevProps.dataSource || type !== ptype) {
204202
this.setState({
205203
form: this.createForm()
206204
})

0 commit comments

Comments
 (0)