-
Notifications
You must be signed in to change notification settings - Fork 116
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
questionAnswers state set to empty on rerender of <Winterfell /> #86
Comments
Hi @geekyme I believe this is by design, your parent component should be capturing the updates to answers and storing them, passing them back down. Otherwise there would be no "acceptable" way to flush out answers when you wanted to clear the form for example. Hope this helps! |
@andrewhathaway so how do i pass them back down? |
@geekyme You can pass them down using the |
I tried that, it doesn't seem to work when the form rerenders with the new props. The prepopulated questionAnswers doesn't fill up the form. |
I'll investigate this at some point this weekend and have a look. |
I've taken a quick look and I cannot reproduce this. Can you get me a test case please? Use this as a base: https://esnextb.in/?gist=07a8b8d62af04bb39693f8bae5344a8b |
I got this problem as well. Just use |
I'm wrapping Winterfell with a component which accepts a prop
role
and use it to fetch schema data dynamically.It seems like whenever Winterfell is rerendered, due to my wrapper component rerendering (due to prop change), it's
questionAnswers
state is being set to {};Sample code:
Debugger:
The problem will happen the moment I remove that
shouldComponentUpdate
block above.The text was updated successfully, but these errors were encountered: