Survey stops working after call to setState
See original GitHub issueAre you requesting a feature, reporting a bug or asking a question?
Bug report, example is attached.
What is the current behavior?
https://next.plnkr.co/edit/ZzdpwCcEQNOQIMjY
If item2 in question2 is selected, then the navigation does not change and question3 stays hidden. This occurs after the call to setState
in componentDidMount
What is the expected behavior?
https://next.plnkr.co/edit/jkXmKgYyTJ8HVon5
After selecting item2 in question2 the survey should reveal question3 and the navigation should show the next page.
How would you reproduce the current behavior (if this is a bug)?
With setState
: https://next.plnkr.co/edit/ZzdpwCcEQNOQIMjY
Without setState
: https://next.plnkr.co/edit/jkXmKgYyTJ8HVon5
Specify your
- browser: Chromium
- browser version: 71
- surveyjs platform: react
- surveyjs version: 1.0.32 - 1.0.65
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
react setState seems to be cancelled by redux dispatch?
So the multiple mapDispatchToProps calls and seeming ignore of setState was due to a new child component re instantiating.
Read more >Lifting State Up - React
When the temperature was in the local state, the TemperatureInput could just call this.setState() to change it. However, now that the temperature is...
Read more >How to Bring Reactivity into React with States - freeCodeCamp
When the Survey updates its state (calls setState ), the render function triggers. If so, it sends a request for Question rendering (details ......
Read more >ReactJS setState() - GeeksforGeeks
setState is asynchronous call means if synchronous call get called it may not get updated at right time like to know current value...
Read more >This.setstate not working in react js - CodeProject
when click on Toggle Person button following error occurred: index.js:1437 Warning: Can't call setState on a component that is not yet ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am still getting this issue while calling any of the React Hook setters.
@andrewtelnov I found a “workaround”, which outlines another or related problem.
https://next.plnkr.co/edit/5q3MP9eY4HDz4ZFI
This forces the child element (i.e., the survey) to reinitialize. Then, the navigation works. However, now the unmounted survey is still alive as we can see in the console (setState is called on an unmounted component).