Skip to content

Commit 4d073c1

Browse files
committed
fix: keep user presence handler in sdk
1 parent c1a78d2 commit 4d073c1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

package/src/components/ChannelList/ChannelList.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ChannelListMessenger, ChannelListMessengerProps } from './ChannelListMe
2525
// import { useNewMessage } from './hooks/listeners/useNewMessage';
2626
// import { useNewMessageNotification } from './hooks/listeners/useNewMessageNotification';
2727
// import { useRemovedFromChannelNotification } from './hooks/listeners/useRemovedFromChannelNotification';
28-
// import { useUserPresence } from './hooks/listeners/useUserPresence';
28+
import { useUserPresence } from './hooks/listeners/useUserPresence';
2929
import { useCreateChannelsContext } from './hooks/useCreateChannelsContext';
3030
import { usePaginatedChannels } from './hooks/usePaginatedChannels';
3131
import { Skeleton as SkeletonDefault } from './Skeleton';
@@ -395,10 +395,10 @@ export const ChannelList = <
395395
// setChannels,
396396
// });
397397
//
398-
// useUserPresence({
399-
// setChannels,
400-
// setForceUpdate,
401-
// });
398+
useUserPresence({
399+
setChannels: channelManager.setChannels,
400+
setForceUpdate,
401+
});
402402

403403
const channelIdsStr = channels?.reduce((acc, channel) => `${acc}${channel.cid}`, '');
404404

package/src/components/ChannelList/hooks/listeners/useUserPresence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { DefaultStreamChatGenerics } from '../../../../types/types';
88

99
type Parameters<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> =
1010
{
11-
setChannels: React.Dispatch<React.SetStateAction<Channel<StreamChatGenerics>[] | null>>;
11+
setChannels: React.Dispatch<React.SetStateAction<Channel<StreamChatGenerics>[]>>;
1212
setForceUpdate: React.Dispatch<React.SetStateAction<number>>;
1313
};
1414

package/src/components/ChannelList/hooks/usePaginatedChannels.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ export const usePaginatedChannels = <
127127
* TODO: if we move the channel state to a single context and share it between ChannelList, Channel and Thread we can remove this
128128
*/
129129
if (queryType === 'loadChannels') {
130-
await channelManager?.loadNext();
130+
await channelManager.loadNext();
131131
} else {
132-
await channelManager?.queryChannels(filters, sort, newOptions, {
132+
await channelManager.queryChannels(filters, sort, newOptions, {
133133
skipInitialization: enableOfflineSupport ? undefined : activeChannels.current,
134134
});
135135
}
@@ -234,7 +234,7 @@ export const usePaginatedChannels = <
234234
skipInitialization: [], // passing empty array will clear out the existing messages from channel state, this removes the possibility of duplicate messages
235235
});
236236

237-
channelManager?.setChannels(offlineChannels);
237+
channelManager.setChannels(offlineChannels);
238238
setStaticChannelsActive(true);
239239
}
240240
} catch (e) {
@@ -298,7 +298,7 @@ export const usePaginatedChannels = <
298298
// channels === null,
299299
loadingChannels: activeQueryType.current === 'queryLocalDB' ? true : pagination?.isLoading,
300300
loadingNextPage: pagination?.isLoadingNext,
301-
loadNextPage: channelManager?.loadNext,
301+
loadNextPage: channelManager.loadNext,
302302
refreshing: activeQueryType.current === 'refresh',
303303
refreshList,
304304
reloadList,

0 commit comments

Comments
 (0)