@@ -380,7 +380,7 @@ describe('Channel', () => {
380380 await waitFor ( ( ) => expect ( asFragment ( ) ) . toMatchSnapshot ( ) ) ;
381381 } ) ;
382382
383- it ( 'should render empty channel container if channels query failed' , async ( ) => {
383+ it ( 'should render empty channel container if channels query failed and no channel is available ' , async ( ) => {
384384 const childrenContent = 'Channel children' ;
385385 const { asFragment } = render (
386386 < ChatProvider
@@ -399,6 +399,58 @@ describe('Channel', () => {
399399 await waitFor ( ( ) => expect ( asFragment ( ) ) . toMatchSnapshot ( ) ) ;
400400 } ) ;
401401
402+ it ( 'should render channel content if channels query failed but channel is available' , async ( ) => {
403+ const childrenContent = 'Channel children' ;
404+ await channel . watch ( ) ;
405+ render (
406+ < ChatProvider
407+ value = { fromPartial < ChatContextValue > ( {
408+ channelsQueryState : {
409+ error : new Error ( 'pagination failed' ) ,
410+ queryInProgress : null ,
411+ setError : vi . fn ( ) ,
412+ setQueryInProgress : vi . fn ( ) ,
413+ } ,
414+ client : chatClient ,
415+ searchController : new SearchController ( ) ,
416+ } ) }
417+ >
418+ < Channel channel = { channel } > { childrenContent } </ Channel >
419+ </ ChatProvider > ,
420+ ) ;
421+ await waitFor ( ( ) => expect ( screen . getByText ( childrenContent ) ) . toBeInTheDocument ( ) ) ;
422+ } ) ;
423+
424+ it ( 'should render channel content if channels query failed and channel is available even if LoadingErrorIndicator is provided' , async ( ) => {
425+ const errMsg = 'Channels query failed' ;
426+ const childrenContent = 'Channel children' ;
427+ await channel . watch ( ) ;
428+ render (
429+ < ChatProvider
430+ value = { fromPartial < ChatContextValue > ( {
431+ channelsQueryState : {
432+ error : new Error ( errMsg ) ,
433+ queryInProgress : null ,
434+ setError : vi . fn ( ) ,
435+ setQueryInProgress : vi . fn ( ) ,
436+ } ,
437+ client : chatClient ,
438+ searchController : new SearchController ( ) ,
439+ } ) }
440+ >
441+ < WithComponents
442+ overrides = { {
443+ LoadingErrorIndicator : ( { error } ) => < div > { error . message } </ div > ,
444+ } }
445+ >
446+ < Channel channel = { channel } > { childrenContent } </ Channel >
447+ </ WithComponents >
448+ </ ChatProvider > ,
449+ ) ;
450+ await waitFor ( ( ) => expect ( screen . getByText ( childrenContent ) ) . toBeInTheDocument ( ) ) ;
451+ expect ( screen . queryByText ( errMsg ) ) . not . toBeInTheDocument ( ) ;
452+ } ) ;
453+
402454 it ( 'should render provided loading indicator if channels query is in progress' , async ( ) => {
403455 const childrenContent = 'Channel children' ;
404456 const loadingText = 'Loading channels' ;
0 commit comments