File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
examples/SampleApp/src/screens
package/src/components/Channel Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ const options = {
6767 presence : true ,
6868 state : true ,
6969 watch : true ,
70+ message_limit : 25 ,
7071} ;
7172
7273const HeaderNetworkDownIndicator = ( ) => null ;
Original file line number Diff line number Diff line change @@ -161,8 +161,10 @@ describe('useMessageListPagination', () => {
161161
162162 await waitFor ( ( ) => {
163163 expect ( queryFn ) . toHaveBeenCalledWith ( {
164- messages : { id_lt : messages [ 0 ] . id } ,
165- watchers : { } ,
164+ messages : { id_lt : messages [ 0 ] . id , limit : 10 } ,
165+ watchers : {
166+ limit : 10 ,
167+ } ,
166168 } ) ;
167169 expect ( result . current . state . hasMore ) . toBe ( true ) ;
168170 expect ( result . current . state . messages . length ) . toBe ( 40 ) ;
@@ -252,8 +254,8 @@ describe('useMessageListPagination', () => {
252254
253255 await waitFor ( ( ) => {
254256 expect ( queryFn ) . toHaveBeenCalledWith ( {
255- messages : { id_gt : messages [ messages . length - 1 ] . id } ,
256- watchers : { } ,
257+ messages : { id_gt : messages [ messages . length - 1 ] . id , limit : 10 } ,
258+ watchers : { limit : 10 } ,
257259 } ) ;
258260 expect ( result . current . state . hasMore ) . toBe ( true ) ;
259261 expect ( result . current . state . messages . length ) . toBe ( 40 ) ;
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
7474 /**
7575 * This function loads more messages before the first message in current channel state.
7676 */
77- const loadMore = useStableCallback ( async ( limit ? : number ) => {
77+ const loadMore = useStableCallback ( async ( limit : number = 10 ) => {
7878 if ( ! channel . state . messagePagination . hasPrev ) {
7979 return ;
8080 }
@@ -103,7 +103,7 @@ export const useMessageListPagination = ({ channel }: { channel: Channel }) => {
103103 /**
104104 * This function loads more messages after the most recent message in current channel state.
105105 */
106- const loadMoreRecent = useStableCallback ( async ( limit ? : number ) => {
106+ const loadMoreRecent = useStableCallback ( async ( limit : number = 10 ) => {
107107 if ( ! channel . state . messagePagination . hasNext ) {
108108 return ;
109109 }
You can’t perform that action at this time.
0 commit comments