epicollect / epi-collect

🌏🌎🌍 Liberate Google Takeout location data for epidemiological research and local contact tracing https://epi-collect.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Go to http://localhost:3000/wizard
  2. Upload some data (e.g. in tests/data)
  3. Draw some polygons on the map
  4. Click 'Next'
  5. Now go back via the breadcrumbs to 'Review and filter data'.
  6. Click the "hand" icon to go into dragging mode.
  7. Click on the polygon.
  8. 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.