Skip to content

Do not set state when component is unmounted #90

Description

@magnusart

Hi

There is a memory leak that pops up in certain situations. I suspect the case sis that the component has been unmounted before image loading has finished and the promise then tries to update the state.

Warning: Can't call setState (or forceUpdate) 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.

The error message describes what needs to be done. Here is an example of a (not so pretty) solution I found whilst googling:
wcandillon/react-progressive-image-loading@d4b2f65

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