stream-chat-angular 3.8.0 → 3.8.1

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.
@@ -1 +1 @@
1
- export declare const version = "3.8.0";
1
+ export declare const version = "3.8.1";
@@ -354,7 +354,7 @@
354
354
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
355
355
  }
356
356
 
357
- var version = '3.8.0';
357
+ var version = '3.8.1';
358
358
 
359
359
  /**
360
360
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -691,11 +691,8 @@
691
691
  var currentChannels = _this.channelsSubject.getValue() || [];
692
692
  var newChannels = channels.filter(function (c) { return !currentChannels.find(function (channel) { return channel.cid === c.cid; }); });
693
693
  var deletedChannels = currentChannels.filter(function (c) { return !(channels === null || channels === void 0 ? void 0 : channels.find(function (channel) { return channel.cid === c.cid; })); });
694
- _this.addChannelsFromNotification(newChannels);
694
+ void _this.addChannelsFromNotification(newChannels);
695
695
  _this.removeChannelsFromChannelList(deletedChannels.map(function (c) { return c.cid; }));
696
- if (!newChannels.length && !deletedChannels.length) {
697
- _this.channelsSubject.next(channels);
698
- }
699
696
  };
700
697
  this.messageListSetter = function (messages) {
701
698
  _this.activeChannelMessagesSubject.next(messages);
@@ -1334,24 +1331,41 @@
1334
1331
  };
1335
1332
  ChannelService.prototype.handleNewMessageNotification = function (clientEvent) {
1336
1333
  if (clientEvent.event.channel) {
1337
- this.addChannelsFromNotification([clientEvent.event.channel]);
1334
+ void this.addChannelsFromNotification([clientEvent.event.channel]);
1338
1335
  }
1339
1336
  };
1340
1337
  ChannelService.prototype.handleAddedToChannelNotification = function (clientEvent) {
1341
1338
  if (clientEvent.event.channel) {
1342
- this.addChannelsFromNotification([clientEvent.event.channel]);
1339
+ void this.addChannelsFromNotification([clientEvent.event.channel]);
1343
1340
  }
1344
1341
  };
1345
1342
  ChannelService.prototype.addChannelsFromNotification = function (channelResponses) {
1346
- var _this = this;
1347
- var newChannels = [];
1348
- channelResponses.forEach(function (channelResponse) {
1349
- var channel = _this.chatClientService.chatClient.channel(channelResponse.type, channelResponse.id);
1350
- void channel.watch();
1351
- _this.watchForChannelEvents(channel);
1352
- newChannels.push(channel);
1343
+ return __awaiter(this, void 0, void 0, function () {
1344
+ var newChannels, watchRequests, currentChannels;
1345
+ var _this = this;
1346
+ return __generator(this, function (_h) {
1347
+ switch (_h.label) {
1348
+ case 0:
1349
+ newChannels = [];
1350
+ watchRequests = [];
1351
+ channelResponses.forEach(function (channelResponse) {
1352
+ var channel = _this.chatClientService.chatClient.channel(channelResponse.type, channelResponse.id);
1353
+ watchRequests.push(channel.watch());
1354
+ newChannels.push(channel);
1355
+ });
1356
+ return [4 /*yield*/, Promise.all(watchRequests)];
1357
+ case 1:
1358
+ _h.sent();
1359
+ currentChannels = this.channelsSubject.getValue() || [];
1360
+ newChannels = newChannels.filter(function (newChannel) { return !currentChannels.find(function (c) { return c.cid === newChannel.cid; }); });
1361
+ if (newChannels.length > 0) {
1362
+ newChannels.forEach(function (c) { return _this.watchForChannelEvents(c); });
1363
+ this.channelsSubject.next(__spreadArray(__spreadArray([], __read(newChannels)), __read(currentChannels)));
1364
+ }
1365
+ return [2 /*return*/];
1366
+ }
1367
+ });
1353
1368
  });
1354
- this.channelsSubject.next(__spreadArray(__spreadArray([], __read(newChannels)), __read((this.channelsSubject.getValue() || []))));
1355
1369
  };
1356
1370
  ChannelService.prototype.removeChannelsFromChannelList = function (cids) {
1357
1371
  var _a;