Skip to content

Trying to setState when unmounted #3

Open
@mogelbrod

Description

@mogelbrod

use-measure@0.2.2

This error happens in our app when a component using use-measure is unmounted due to a resize:

use-measure.js:46: 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.

Line 46 maps to the setContentRect(entry.contentRect) call inside the rAF closure. I'm guessing the rAF request isn't cancelled in time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions