form icon indicating copy to clipboard operation
form copied to clipboard

[BUG] When returning null in render method after component has been mounted, #cleanUpUselessFields() can not be called

Open smalldragonluo opened this issue 6 years ago • 0 comments

When I want to prevent code execution in the render method before the requested data is returned, I might return a null value directly. If this is after the componentDidMount() method has been executed, the cleanUpUselessFields() in rc-form can not be called, because it can only be called in componentDidMount() and componentDidUpdate().

Then I got an error: Warning: Duplicate field names will result in both fields getting edited together. Field names must be unique.

https://github.com/react-component/form/blob/master/src/createBaseForm.js#L87

{
  render() {
    if (!configInfo) {
    return null;
    
   // getFieldDecorator(...)
  }
}

smalldragonluo avatar Jul 01 '19 14:07 smalldragonluo