GetStream / stream-chat-js

JS / Browser Client - Build Chat with GetStream.io
https://getstream.io/chat/
Other
178 stars 76 forks source link

fix: skip updateUserMessageReferences if channel is undefined #1249

Closed arnautov-anton closed 6 months ago

arnautov-anton commented 6 months ago

Description of the changes, What, Why and How?

Fixes an issue where apps would crash due missing state on undefined channel when trying to update userChannelReferences.

Error in question:

TypeError: Cannot read properties of undefined (reading 'state')
node_modules/stream-chat/dist/browser.es.js at line 6861:31

    _defineProperty(this, "_updateUserMessageReferences", function (user) {
      var refMap = _this.state.userChannelReferences[user.id] || {};

      for (var _channelID2 in refMap) {
        var _channel3 = _this.activeChannels[_channelID2];
        var state = _channel3.state;
        /** update the messages from this user. */

        state === null || state === void 0 ? void 0 : state.updateUserMessages(user);
      }
    });
github-actions[bot] commented 6 months ago

Size Change: +44 B (0%)

Total Size: 352 kB

Filename Size Change
dist/browser.es.js 76 kB +10 B (0%)
dist/browser.full-bundle.min.js 46.4 kB +8 B (0%)
dist/browser.js 76.9 kB +9 B (0%)
dist/index.es.js 76 kB +9 B (0%)
dist/index.js 77 kB +8 B (0%)

compressed-size-action