File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
projects/stream-chat-angular/src/lib Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -958,7 +958,7 @@ export class ChannelService<
958958 */
959959 addChannel ( channel : Channel < T > ) {
960960 if ( ! this . channelManager ) {
961- throw new Error ( 'Channel service not initialized' ) ;
961+ this . createChannelManager ( { eventHandlerOverrides : undefined } ) ;
962962 }
963963 if ( ! this . channels . find ( ( c ) => c . cid === channel . cid ) ) {
964964 this . channelManager ?. setChannels (
@@ -977,7 +977,7 @@ export class ChannelService<
977977 */
978978 removeChannel ( cid : string ) {
979979 if ( ! this . channelManager ) {
980- throw new Error ( 'Channel service not initialized' ) ;
980+ this . createChannelManager ( { eventHandlerOverrides : undefined } ) ;
981981 }
982982 const remainingChannels = this . channels . filter ( ( c ) => c . cid !== cid ) ;
983983
@@ -1878,6 +1878,9 @@ export class ChannelService<
18781878 } : {
18791879 eventHandlerOverrides ?: ChannelManagerEventHandlerOverrides < T > ;
18801880 } ) {
1881+ if ( this . channelManager ) {
1882+ this . destroyChannelManager ( ) ;
1883+ }
18811884 this . channelManager = new ChannelManager ( {
18821885 client : this . chatClientService . chatClient ,
18831886 options : {
You can’t perform that action at this time.
0 commit comments