Skip to content

Commit

Permalink
fix: do not skip initialisation when querying channels (#2034)
Browse files Browse the repository at this point in the history
  • Loading branch information
santhoshvai committed Apr 4, 2023
1 parent 42e9c67 commit f639ffb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { useEffect, useMemo, useRef, useState } from 'react';

import type { Channel, ChannelFilters, ChannelOptions, ChannelSort } from 'stream-chat';

import { useActiveChannelsRefContext } from '../../../contexts/activeChannelsRefContext/ActiveChannelsRefContext';

import { useChatContext } from '../../../contexts/chatContext/ChatContext';
import { useIsMountedRef } from '../../../hooks/useIsMountedRef';

Expand Down Expand Up @@ -52,8 +50,6 @@ export const usePaginatedChannels = <
const [staticChannelsActive, setStaticChannelsActive] = useState<boolean>(false);
const [activeQueryType, setActiveQueryType] = useState<QueryType | null>('queryLocalDB');
const [hasNextPage, setHasNextPage] = useState<boolean>(false);

const activeChannels = useActiveChannelsRefContext();
const isMountedRef = useIsMountedRef();
const { client } = useChatContext<StreamChatGenerics>();

Expand Down Expand Up @@ -111,10 +107,7 @@ export const usePaginatedChannels = <
}
}

// TODO: Think about the implications of this.
const channelQueryResponse = await client.queryChannels(filters, sort, newOptions, {
skipInitialization: enableOfflineSupport ? activeChannelIds : activeChannels.current,
});
const channelQueryResponse = await client.queryChannels(filters, sort, newOptions);
if (isQueryStale() || !isMountedRef.current) {
return;
}
Expand Down
1 change: 1 addition & 0 deletions package/src/utils/DBSyncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class DBSyncManager {
*/
static onSyncStatusChange = (listener: (status: boolean) => void) => {
this.listeners.push(listener);
listener(this.syncStatus);

return {
unsubscribe: () => {
Expand Down

0 comments on commit f639ffb

Please sign in to comment.