Resizing window gives warnings to console
jepaavol opened this issue · 0 comments
When browser window is resized it seems that component still calls setState once it has been unmounted. This causes error prints to console:
Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the Textfit component.
Problematic code part is this.
], err => { // err will be true, if another process was triggered if (err) return; this.setState({ ready: true }, () => onReady(mid)); });
Issue gets fixed if shouldCancelProcess is checked before state is updated like this:
], err => { // err will be true, if another process was triggered if (err || shouldCancelProcess()) return; this.setState({ ready: true }, () => onReady(mid)); });