stream-chat-angular 3.3.1 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ import transliterate from '@stream-io/transliterate';
17
17
  import * as i7 from 'angular-mentions';
18
18
  import { MentionModule } from 'angular-mentions';
19
19
 
20
- const version = '3.3.1';
20
+ const version = '3.4.0';
21
21
 
22
22
  /**
23
23
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -371,6 +371,7 @@ class ChannelService {
371
371
  if (!activeChannel) {
372
372
  return;
373
373
  }
374
+ this.stopWatchForActiveChannelEvents(activeChannel);
374
375
  this.activeChannelMessagesSubject.next([]);
375
376
  this.activeChannelSubject.next(undefined);
376
377
  this.activeParentMessageIdSubject.next(undefined);
@@ -463,8 +464,9 @@ class ChannelService {
463
464
  message_limit: this.messagePageSize,
464
465
  };
465
466
  this.sort = sort || { last_message_at: -1, updated_at: -1 };
466
- const result = yield this.queryChannels(shouldSetActiveChannel);
467
- this.chatClientService.events$.subscribe((notification) => void this.handleNotification(notification));
467
+ this.shouldSetActiveChannel = shouldSetActiveChannel;
468
+ const result = yield this.queryChannels(this.shouldSetActiveChannel);
469
+ this.clientEventsSubscription = this.chatClientService.events$.subscribe((notification) => void this.handleNotification(notification));
468
470
  return result;
469
471
  });
470
472
  }
@@ -472,8 +474,10 @@ class ChannelService {
472
474
  * Resets the `activeChannel$`, `channels$` and `activeChannelMessages$` Observables. Useful when disconnecting a chat user, use in combination with [`disconnectUser`](./ChatClientService.mdx/#disconnectuser).
473
475
  */
474
476
  reset() {
477
+ var _a;
475
478
  this.deselectActiveChannel();
476
479
  this.channelsSubject.next(undefined);
480
+ (_a = this.clientEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
477
481
  }
478
482
  /**
479
483
  * Loads the next page of channels. The page size can be set in the [query option](https://getstream.io/chat/docs/javascript/query_channels/?language=javascript#query-options) object.
@@ -708,6 +712,13 @@ class ChannelService {
708
712
  }
709
713
  handleNotification(clientEvent) {
710
714
  switch (clientEvent.eventType) {
715
+ case 'connection.recovered': {
716
+ this.ngZone.run(() => {
717
+ this.reset();
718
+ void this.init(this.filters, this.sort, this.options, this.shouldSetActiveChannel);
719
+ });
720
+ break;
721
+ }
711
722
  case 'notification.message_new': {
712
723
  this.ngZone.run(() => {
713
724
  if (this.customNewMessageNotificationHandler) {