Skip to content

useSubscription unsubscribes after the first render #232

Open
@performanceArtist

Description

@performanceArtist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions