Commit 0d773f97 by zhaochengxiang

bug fix

parent 0283d219
......@@ -269,8 +269,6 @@ const AttributeRelationModal = (props) => {
const [ elements, setElements] = useState([]);
const [ activeKey, setActiveKey ] = useState();
const activeKeyRef = useRef();
useEffect(() => {
if (visible) {
getSourceModels();
......@@ -292,12 +290,7 @@ const AttributeRelationModal = (props) => {
setLoadingSourceModels(false)
setSourceModels(data||[])
if (!activeKeyRef.current) {
activeKeyRef.current = data?.length > 0 ? data[0] : AddSourceModelName
setActiveKey(data?.length > 0 ? data[0] : AddSourceModelName)
} else if (activeKeyRef.current !== activeKey) {
setActiveKey(activeKeyRef.current)
}
},
error: () => {
setLoadingSourceModels(false)
......@@ -342,18 +335,11 @@ const AttributeRelationModal = (props) => {
}
const onTabsChange = (value) => {
activeKeyRef.current = value
setActiveKey(value)
}
const onRelationChange = (type, value) => {
if (type === 'delete') {
activeKeyRef.current = undefined
getSourceModels()
} else if (type === 'update') {
activeKeyRef.current = value
getSourceModels()
}
}
const reset = () => {
......
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