Fix warning about state update on unmounted component
larsmennen opened this issue · comments
Description
When navigating back to the map to filter data, there's a minor bug where clicking on a previously drawn polygon causes an attempted state update on an unmounted component.
Steps to reproduce
- Go to http://localhost:3000/wizard
- Upload some data (e.g. in
tests/data
) - Draw some polygons on the map
- Click 'Next'
- Now go back via the breadcrumbs to 'Review and filter data'.
- Click the "hand" icon to go into dragging mode.
- Click on the polygon.
- Console will throw:
index.js:1 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
in GeoMap (at GeoMap.tsx:23)
in Unknown (at SelectData.tsx:21)
in div (at SelectData.tsx:20)
in SelectData (created by Context.Consumer)
in Route (at Wizard.tsx:85)
This warning should not appear.