You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
saveRef(name,_,component){if(!component){// after destroy, delete datadeletethis.fieldsMeta[name];deletethis.fields[name];deletethis.instances[name];deletethis.cachedBind[name];return;}constfieldMeta=this.getFieldMeta(name);// 第二次调用时 由于 fieldMeta 为空, 所以并不会执行 ref(component)if(fieldMeta){constref=fieldMeta.ref;if(ref){if(typeofref==='string'){thrownewError(`can not set ref string for ${name}`);}ref(component);}}this.instances[name]=component;},
错误:
Form 由于使用了高阶组件, 先调用了 getFieldProps , 包含初始化 fieldMeta
rc-form 重载了 ref
该方法会在 component unmount 时调用
saveRef 清理了 meta state
在 react attachRef时, saveRef 会再次被调用, 但此时 fieldMeta 已经在 unmount 时被删除了
所以此时 ref(component) 不会被触发, 导致报错
The text was updated successfully, but these errors were encountered: