Skip to content

Commit 442ec8c

Browse files
author
jaapbakker88
authored
Merge pull request #115 from GetStream/feature/update-filters
allow changing of filters and sort params to update channellist
2 parents e3af285 + bedc786 commit 442ec8c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Diff for: src/components/ChannelList.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,24 @@ const ChannelList = withChatContext(
188188
this.listenToChanges();
189189
}
190190

191-
componentDidUpdate() {
191+
async componentDidUpdate(prevProps) {
192+
// do we need deepequal?
193+
if (
194+
!isEqual(prevProps.filters, this.props.filters) ||
195+
!isEqual(prevProps.sort, this.props.sort)
196+
) {
197+
await this.setState({
198+
error: false,
199+
channels: Immutable([]),
200+
channelIds: Immutable([]),
201+
loadingChannels: true,
202+
hasNextPage: true,
203+
refreshing: false,
204+
offset: 0,
205+
});
206+
await this.queryChannels();
207+
}
208+
192209
this.props.logger('ChannelList component', 'componentDidUpdate', {
193210
tags: ['lifecycle', 'channellist'],
194211
props: this.props,

0 commit comments

Comments
 (0)