File tree 1 file changed +12
-6
lines changed
1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -315,22 +315,28 @@ const ChannelList = withChatContext(
315
315
getQueryParams = ( queryType ) => {
316
316
const { options, filters, sort } = this . props ;
317
317
let offset ;
318
+ let limit ;
318
319
319
320
if ( queryType === 'refresh' || queryType === 'reload' ) {
320
321
offset = 0 ;
321
- options . limit =
322
- this . state . channels . length === 0
323
- ? options . limit || DEFAULT_QUERY_CHANNELS_LIMIT
324
- : this . state . channels . length < MAX_QUERY_CHANNELS_LIMIT
325
- ? this . state . channels . length
326
- : MAX_QUERY_CHANNELS_LIMIT ;
322
+ limit = MAX_QUERY_CHANNELS_LIMIT ;
323
+ if ( this . state . channels . length === 0 ) {
324
+ limit = options . limit || DEFAULT_QUERY_CHANNELS_LIMIT ;
325
+ } else if ( this . state . channels . length < MAX_QUERY_CHANNELS_LIMIT ) {
326
+ limit = Math . max (
327
+ this . state . channels . length ,
328
+ DEFAULT_QUERY_CHANNELS_LIMIT ,
329
+ ) ;
330
+ }
327
331
} else {
332
+ limit = options . limit || DEFAULT_QUERY_CHANNELS_LIMIT ;
328
333
offset = this . state . offset ;
329
334
}
330
335
331
336
const queryOptions = {
332
337
...options ,
333
338
offset,
339
+ limit,
334
340
} ;
335
341
336
342
return {
You can’t perform that action at this time.
0 commit comments