-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
When you move around between views within the app, you sometimes get React warnings:
index_bundle.js:21229 Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.
Please check the code for the TabbedMetricsTable component.
My theory on this is that if we leave a page in the middle of a fetch, after the fetch completes, the page still tries to update, even though it's unmounted.
We should either:
- store an
isMountedproperty in componentDidMount and unset it in componentWillUnmount, and only call setState ifisMountedis true (<- band aid) - wrap our fetch calls in a cancelable promise (<- more ideal)
Helpful resource:
https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html
Reactions are currently unavailable