Skip to content

ChannelList reaload everytime parent state change #68

@tranlehaiquan

Description

@tranlehaiquan

Hello,
I want to change my location from message -> message/:channelId when the user clicks on the channel. But I face with the problem that every time location changes (eg: message/channel1 -> message/channel2). I find it out because this line in usePaginatedChannels.js. useEffect always run because it can't compare filters. (line 82) I replace it with use-deep-compare-effect and it work.

useEffect(() => {
    queryChannels('reload');
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [filters]);

To

import useDeepCompareEffect from 'use-deep-compare-effect'

useDeepCompareEffect(() => {
    queryChannels('reload');
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [filters]);

Sorry wrong repo. I will close this.

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