Commit 93c46d1e by zhaochengxiang

bug fix

parent 14cb0e23
...@@ -36,6 +36,12 @@ const FC = (props) => { ...@@ -36,6 +36,12 @@ const FC = (props) => {
}, [metadataId]) }, [metadataId])
React.useEffect(() => { React.useEffect(() => {
if (datasource && (supportedTargetTypes??[]).length > 0) {
setSelectedTargetType(datasource?.type ? datasource?.type : supportedTargetTypes[0].targetType)
}
}, [datasource, supportedTargetTypes])
React.useEffect(() => {
const index = (supportedDatasourceTypies??[]).findIndex(item => item.type === selectedTargetType) const index = (supportedDatasourceTypies??[]).findIndex(item => item.type === selectedTargetType)
if (index !== -1) { if (index !== -1) {
setDatasourceType(supportedDatasourceTypies[index]) setDatasourceType(supportedDatasourceTypies[index])
...@@ -57,7 +63,6 @@ const FC = (props) => { ...@@ -57,7 +63,6 @@ const FC = (props) => {
callback: data => { callback: data => {
setLoading(false) setLoading(false)
setDatasource(data) setDatasource(data)
setSelectedTargetType(data?.type)
}, },
error: () => { error: () => {
setLoading(false) setLoading(false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment