Skip to content

Commit 10ad331

Browse files
committed
fix: use channel list ready state
1 parent 4d073c1 commit 10ad331

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const selector = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
5151
({
5252
channels: nextValue.channels,
5353
pagination: nextValue.pagination,
54+
ready: nextValue.ready,
5455
} as const);
5556

5657
export const usePaginatedChannels = <
@@ -72,7 +73,7 @@ export const usePaginatedChannels = <
7273
const activeChannels = useActiveChannelsRefContext();
7374
const isMountedRef = useIsMountedRef();
7475
const { client } = useChatContext<StreamChatGenerics>();
75-
const { channels, pagination } = useStateStore(channelManager?.state, selector) ?? {};
76+
const { channels, pagination, ready } = useStateStore(channelManager?.state, selector) ?? {};
7677
const hasNextPage = pagination?.hasNext;
7778

7879
const filtersRef = useRef<typeof filters | null>(null);
@@ -296,7 +297,8 @@ export const usePaginatedChannels = <
296297
// ? true
297298
// : (activeQueryType.current === 'reload' || activeQueryType.current === null) &&
298299
// channels === null,
299-
loadingChannels: activeQueryType.current === 'queryLocalDB' ? true : pagination?.isLoading,
300+
loadingChannels:
301+
activeQueryType.current === 'queryLocalDB' ? true : pagination?.isLoading || !ready,
300302
loadingNextPage: pagination?.isLoadingNext,
301303
loadNextPage: channelManager.loadNext,
302304
refreshing: activeQueryType.current === 'refresh',

0 commit comments

Comments
 (0)