Skip to content

Warning while testing DataGrid which I believe is from useTubular #197

Open
@nickpalmer

Description

@nickpalmer

Describe the bug

While testing a component using DataGrid I am getting the following warning:

console.error ../../node_modules/react-dom/cjs/react-dom.development.js:88
      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 a useEffect cleanup function.

To Reproduce
Steps to reproduce the behavior:

  1. Write a test which mounts a DataGrid

Expected behavior
There shouldn't be a warning.

I believe this is caused by useTubular calling useEffect() but not returning a cleanup function, so the dispatch when the API call is complete fires after the component is unmounted.

Ideally the processRequest() api could be updated to handle the return of a Future which can be canceled. I will try to put a PR together to fix this, but no promises on timing on that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions