Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the Form Item could not edit #9790

Closed
eruca opened this issue Mar 23, 2018 · 9 comments
Closed

the Form Item could not edit #9790

eruca opened this issue Mar 23, 2018 · 9 comments
Assignees

Comments

@eruca
Copy link
Contributor

@eruca eruca commented Mar 23, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

3.3.1

Environment

macOS 10.13.3 Chrome 63

Reproduction link

Edit on CodeSandbox

Steps to reproduce

the Input can not input any value

What is expected?

can be edit

What is actually happening?

not

@benjycui
Copy link
Contributor

@benjycui benjycui commented Mar 26, 2018

Please make sure that your demo work.

image

@eruca
Copy link
Contributor Author

@eruca eruca commented Mar 26, 2018

sorry, I test it myself by adding something without deleting it. Now it can present the problem;

@benjycui
Copy link
Contributor

@benjycui benjycui commented Mar 27, 2018

BasicComponent haven't been re-rendered, you can try to simplify your demo and find out why.

@eruca
Copy link
Contributor Author

@eruca eruca commented Mar 27, 2018

the BasicComponent add

state = {
    value:''
}

and the WrappedComponent add onChange, will work, I change the demo in CodeSanbox;
exists another way without adding state; like

<Form>
{getFieldDecorator(id, option)(<Input />)
</Form>
@eruca
Copy link
Contributor Author

@eruca eruca commented Mar 27, 2018

I read the code, and found the pro.ant.design Login did not have a state for value, can you give some hint?

@eruca
Copy link
Contributor Author

@eruca eruca commented Apr 10, 2018

@afc163 can help?

@yesmeck
Copy link
Member

@yesmeck yesmeck commented Apr 11, 2018

@eruca Your codesandbox seems works now, could you confirm that your issue still exists?

@eruca
Copy link
Contributor Author

@eruca eruca commented Apr 12, 2018

yes, but the solution is ugly. I need to add a state useless, just to control re-render, I read the pro.ant.design, there are no state in the BasicComponent, I want to ask why, how can i improve my code ?

@yesmeck
Copy link
Member

@yesmeck yesmeck commented Apr 13, 2018

Because we considered Form is a pure component

shouldComponentUpdate(...args: any[]) {
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
}

If you want to use context, try the new React.createContext API.

@yesmeck yesmeck closed this Apr 13, 2018
yesmeck added a commit that referenced this issue Apr 13, 2018
Related #9790

Form and Form.Item are not considered as pure components
afc163 added a commit that referenced this issue Apr 19, 2018
Related #9790

Form and Form.Item are not considered as pure components
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants