dx-platform icon indicating copy to clipboard operation
dx-platform copied to clipboard

useSubscription unsubscribes after the first render

Open performanceArtist opened this issue 4 years ago • 2 comments

useSubscription doesn't work - useMemo creates the subscription during the first render, but then useEffect unsubscribes after the component has mounted(there are no deps in useEffect call). Also I think useMemo should not be used for the subscription effect - it can trigger other effects before the initial rendering is complete. I have a case where it messes up some DOM manipulations. The solution would be using useEffect both for the subscription effect and the cleanup.

performanceArtist avatar Sep 19 '20 14:09 performanceArtist

any progress here?

scink avatar Oct 19 '20 12:10 scink

I don't quite understand how to make a contribution - I'm getting 403 status error when I'm trying to push a new branch. Should I fork the repo? Other than that, the obvious solution would be to add [] to useEffect dependencies.

performanceArtist avatar Oct 25 '20 18:10 performanceArtist