Skip to content

Clean up effects when component unmount  #37

@fnick851

Description

@fnick851

I am using the library with Next.js and when I navigate to a different page for the first time I get this error:

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.
    at ControlsProvider (webpack-internal:///./node_modules/react-three-gui/dist/react-three-gui.esm.js:89:23)
    at DebugUIScene
    at LoadableComponent (webpack-internal:///./node_modules/next/dist/next-server/lib/loadable.js:187:37)
    at div
    at div
    at div
    at Layout (webpack-internal:///./components/Layout.tsx:28:23)
    at DebugUI

I think it is because the library does not clean up side effects when component unmounts. But it also could be a specific issue that only happen with such server-side rendered / isomorphic frameworks.

Could you confirm if this is a bug? Or is there a way to get around this?

If you need a reproduction project I can set one up. Please let me know. Thanks.

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