Skip to content

Commit d0dd875

Browse files
committed
Merge branch 'develop' into V7
2 parents 4e6c4b7 + f8968c0 commit d0dd875

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const usePaginatedChannels = ({
6161
}: Parameters) => {
6262
const [error, setError] = useState<Error | undefined>(undefined);
6363
const [staticChannelsActive, setStaticChannelsActive] = useState<boolean>(false);
64-
const activeQueryType = useRef<QueryType | null>('queryLocalDB');
64+
const [activeQueryType, setActiveQueryType] = useState<QueryType | null>('queryLocalDB');
6565
const activeChannels = useActiveChannelsRefContext();
6666
const isMountedRef = useIsMountedRef();
6767
const { client } = useChatContext();
@@ -109,7 +109,7 @@ export const usePaginatedChannels = ({
109109
setError(undefined);
110110
activeRequestId.current++;
111111
const currentRequestId = activeRequestId.current;
112-
activeQueryType.current = queryType;
112+
setActiveQueryType(queryType);
113113

114114
const newOptions = {
115115
limit: options?.limit ?? MAX_QUERY_CHANNELS_LIMIT,
@@ -147,7 +147,7 @@ export const usePaginatedChannels = ({
147147
// querying.current check is needed in order to make sure the next query call doesnt flick an error
148148
// state and then succeed (reconnect case)
149149
if (retryCount === MAX_NUMBER_OF_RETRIES && !isQueryingRef.current) {
150-
activeQueryType.current = null;
150+
setActiveQueryType(null);
151151
console.warn(err);
152152

153153
setError(
@@ -161,7 +161,7 @@ export const usePaginatedChannels = ({
161161
return queryChannels(queryType, retryCount + 1);
162162
}
163163

164-
activeQueryType.current = null;
164+
setActiveQueryType(null);
165165
};
166166

167167
const refreshList = async () => {
@@ -224,7 +224,7 @@ export const usePaginatedChannels = ({
224224
return false;
225225
}
226226

227-
activeQueryType.current = null;
227+
setActiveQueryType(null);
228228

229229
return true;
230230
};
@@ -274,7 +274,7 @@ export const usePaginatedChannels = ({
274274
error,
275275
hasNextPage,
276276
loadingChannels:
277-
activeQueryType.current === 'queryLocalDB'
277+
activeQueryType === 'queryLocalDB'
278278
? true
279279
: // Although channels.length === 0 should come as a given when we have !channelListInitialized,
280280
// due to the way offline storage works currently we have to do this additional
@@ -285,7 +285,7 @@ export const usePaginatedChannels = ({
285285
pagination?.isLoading || (!channelListInitialized && channels.length === 0),
286286
loadingNextPage: pagination?.isLoadingNext,
287287
loadNextPage: channelManager.loadNext,
288-
refreshing: activeQueryType.current === 'refresh',
288+
refreshing: activeQueryType === 'refresh',
289289
refreshList,
290290
reloadList,
291291
staticChannelsActive,

0 commit comments

Comments
 (0)