netcreateorg / netcreate-2018

Please report bugs, problems, ideas in the project Issues page: https://github.com/netcreateorg/netcreate-2018/issues
Other
11 stars 2 forks source link

Filters React Warning: Can't perform a React state update on an unmounted component. #181

Closed benloh closed 2 years ago

benloh commented 2 years ago
react_devtools_backend.js:2540 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.

This would appear after:

  1. Start app
  2. Close Filter Pane
  3. Re-open Filter Pane
  4. Select "contains" on one of the fields
benloh commented 2 years ago

The issue is that FiltersPanel is unmounted, but it is still listening to UDATA.OnAppStateChange("FDATA", this.UpdateFilterDefs);.

The solution is to add a AppStateChangeOff call to componentWillUnmount, e.g.

  componentWillUnmount() {
    // console.error('TBD: gracefully unsubscribe!')
    UDATA.AppStateChangeOff("FDATA", this.UpdateFilterDefs);
  }
benloh commented 2 years ago

Addressed in #179