wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.47k stars 1.18k forks source link

[Realworld] Unmounted component warning after logging out #784

Closed sodic closed 2 months ago

sodic commented 1 year ago

Our Realworld example app sometimes throws the following error after the user logs out:

react-dom.development.js:67 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 Navbar (http://localhost:3000/static/js/bundle.js:1414:19)
    at div
    at Container (http://localhost:3000/static/js/bundle.js:7948:23)
    at WithStyles (http://localhost:3000/static/js/bundle.js:20180:31)
    at UserSettingsPage (http://localhost:3000/static/js/bundle.js:3721:5)
    at AddHeader
    at http://localhost:3000/static/js/bundle.js:776:69

We should fix it :)

NOTE: We've recently solved a similar error, looking at the fix might help you.

anup-a commented 1 year ago

Hey 👋 @sodic . Great Project. Can I take up this one ?

anup-a commented 1 year ago

Strange but I was not able to reproduce the error. Can you guide me with some steps to reproduce?

sodic commented 1 year ago

Hey, @anup-a, sorry for the late response? If you're still interested, I can give you the instructions on reproducing it in a couple of hours.

infomiho commented 1 year ago

What I got so far:

I'll investigate a bit more to see if there is anything actionable or if we should move to upgrade to React 18 as a means of "fixing" this issue.

sodic commented 1 year ago

Finally they're removing this warning. Half of the code review fixes in my last company were either telling someone to use the isMounted check (when I'm the reviewer), or adding it (when I'm the author).

Anyway, if it's not a memory leak, we can just wait for React 18.

sodic commented 2 months ago

Since realworld no longer exists, I'm closing this.