File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -315,22 +315,28 @@ const ChannelList = withChatContext(
315315 getQueryParams = ( queryType ) => {
316316 const { options, filters, sort } = this . props ;
317317 let offset ;
318+ let limit ;
318319
319320 if ( queryType === 'refresh' || queryType === 'reload' ) {
320321 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+ }
327331 } else {
332+ limit = options . limit || DEFAULT_QUERY_CHANNELS_LIMIT ;
328333 offset = this . state . offset ;
329334 }
330335
331336 const queryOptions = {
332337 ...options ,
333338 offset,
339+ limit,
334340 } ;
335341
336342 return {
You can’t perform that action at this time.
0 commit comments