@@ -53,6 +53,7 @@ export const usePaginatedChannels = ({
5353 const hasNextPage = pagination ?. hasNext ;
5454
5555 const filtersRef = useRef < typeof filters | null > ( null ) ;
56+ const optionsRef = useRef < typeof options | null > ( null ) ;
5657 const sortRef = useRef < typeof sort | null > ( null ) ;
5758 const activeRequestId = useRef < number > ( 0 ) ;
5859 const isQueryingRef = useRef ( false ) ;
@@ -69,10 +70,9 @@ export const usePaginatedChannels = ({
6970 queryType === 'loadChannels' ||
7071 queryType === 'refresh' ||
7172 queryType === 'backgroundRefresh' ||
72- [
73- JSON . stringify ( filtersRef . current ) !== JSON . stringify ( filters ) ,
74- JSON . stringify ( sortRef . current ) !== JSON . stringify ( sort ) ,
75- ] . some ( Boolean ) ;
73+ JSON . stringify ( filtersRef . current ) !== JSON . stringify ( filters ) ||
74+ JSON . stringify ( optionsRef . current ) !== JSON . stringify ( options ) ||
75+ JSON . stringify ( sortRef . current ) !== JSON . stringify ( sort ) ;
7676
7777 const isQueryStale = ( ) => ! isMountedRef || activeRequestId . current !== currentRequestId ;
7878
@@ -87,6 +87,7 @@ export const usePaginatedChannels = ({
8787 }
8888
8989 filtersRef . current = filters ;
90+ optionsRef . current = options ;
9091 sortRef . current = sort ;
9192 isQueryingRef . current = true ;
9293 activeRequestId . current ++ ;
@@ -146,7 +147,7 @@ export const usePaginatedChannels = ({
146147 } ;
147148
148149 /**
149- * Equality check using stringified filters/sort ensure that we don't make un-necessary queryChannels api calls
150+ * Equality check using stringified filters/options/ sort ensure that we don't make un-necessary queryChannels api calls
150151 * for the scenario:
151152 *
152153 * <ChannelList
@@ -161,6 +162,7 @@ export const usePaginatedChannels = ({
161162 * in return will trigger useEffect. To avoid this, we can add a value check.
162163 */
163164 const filterStr = useMemo ( ( ) => JSON . stringify ( filters ) , [ filters ] ) ;
165+ const optionsStr = useMemo ( ( ) => JSON . stringify ( options ) , [ options ] ) ;
164166 const sortStr = useMemo ( ( ) => JSON . stringify ( sort ) , [ sort ] ) ;
165167
166168 useEffect ( ( ) => {
@@ -178,7 +180,7 @@ export const usePaginatedChannels = ({
178180
179181 return ( ) => listener ?. unsubscribe ?.( ) ;
180182 // eslint-disable-next-line react-hooks/exhaustive-deps
181- } , [ filterStr , sortStr , channelManager ] ) ;
183+ } , [ filterStr , optionsStr , sortStr , channelManager ] ) ;
182184
183185 return {
184186 channelListInitialized,
0 commit comments