stream-chat-react 10.7.1 → 10.7.3
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.
- package/dist/browser.full-bundle.js +25 -7
- package/dist/browser.full-bundle.js.map +1 -1
- package/dist/browser.full-bundle.min.js +3 -3
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/components/Channel/Channel.js +1 -1
- package/dist/components/MessageList/hooks/usePrependMessagesCount.d.ts.map +1 -1
- package/dist/components/MessageList/hooks/usePrependMessagesCount.js +22 -4
- package/dist/css/v2/index.css +1 -1
- package/dist/css/v2/index.css.map +1 -1
- package/dist/css/v2/index.layout.css +1 -1
- package/dist/css/v2/index.layout.css.map +1 -1
- package/dist/index.cjs.js +24 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/scss/v2/Avatar/Avatar-layout.scss +10 -0
- package/dist/scss/v2/Avatar/Avatar-theme.scss +11 -0
- package/dist/scss/v2/Message/Message-layout.scss +40 -16
- package/dist/scss/v2/MessageList/MessageList-layout.scss +8 -0
- package/dist/scss/v2/TypingIndicator/TypingIndicator-layout.scss +4 -0
- package/dist/scss/v2/_emoji-replacement.scss +40 -0
- package/dist/scss/v2/_global-theme-variables.scss +4 -0
- package/dist/scss/v2/index.layout.scss +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -46760,7 +46760,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
46760
46760
|
client.off('user.deleted', handleEvent);
|
|
46761
46761
|
notificationTimeouts.forEach(clearTimeout);
|
|
46762
46762
|
};
|
|
46763
|
-
}, [channel.cid, doMarkReadRequest]);
|
|
46763
|
+
}, [channel.cid, doMarkReadRequest, channelConfig === null || channelConfig === void 0 ? void 0 : channelConfig.read_events]);
|
|
46764
46764
|
React$2.useEffect(function () {
|
|
46765
46765
|
var _a;
|
|
46766
46766
|
if (!state.thread)
|
|
@@ -48355,7 +48355,7 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
48355
48355
|
|
|
48356
48356
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
48357
48357
|
|
|
48358
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.
|
|
48358
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var version$1 = '10.7.3';
|
|
48359
48359
|
|
|
48360
48360
|
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var useChat = function (_a) {
|
|
48361
48361
|
var _b, _c;
|
|
@@ -51180,13 +51180,14 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
51180
51180
|
};
|
|
51181
51181
|
}
|
|
51182
51182
|
|
|
51183
|
-
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};
|
|
51183
|
+
window.StreamChat.StreamChat=StreamChat;window.StreamChat.logChatPromiseExecution=logChatPromiseExecution;window.StreamChat.Channel=Channel;window.ICAL=window.ICAL||{};var STATUSES_EXCLUDED_FROM_PREPEND = ['sending', 'failed'];
|
|
51184
|
+
function usePrependedMessagesCount(messages, hasDateSeparator) {
|
|
51184
51185
|
var firstRealMessageIndex = hasDateSeparator ? 1 : 0;
|
|
51185
51186
|
var firstMessageId = React$2.useRef();
|
|
51186
51187
|
var earliestMessageId = React$2.useRef();
|
|
51187
51188
|
var previousNumItemsPrepended = React$2.useRef(0);
|
|
51188
51189
|
var numItemsPrepended = React$2.useMemo(function () {
|
|
51189
|
-
var _a;
|
|
51190
|
+
var _a, _b;
|
|
51190
51191
|
if (!messages || !messages.length) {
|
|
51191
51192
|
previousNumItemsPrepended.current = 0;
|
|
51192
51193
|
return 0;
|
|
@@ -51202,13 +51203,30 @@ var StreamChatReact = (function (exports, React$2, streamChat, ReactDOM) {
|
|
|
51202
51203
|
earliestMessageId.current = currentFirstMessageId;
|
|
51203
51204
|
// if new messages were prepended, find out how many
|
|
51204
51205
|
// start with this number because there cannot be fewer prepended items than before
|
|
51206
|
+
var adjustPrependedMessageCount = 0;
|
|
51205
51207
|
for (var i = previousNumItemsPrepended.current; i < messages.length; i += 1) {
|
|
51208
|
+
// Optimistic UI update, when sending messages, can lead to a situation, when
|
|
51209
|
+
// the order of the messages changes for a moment. This can happen, when a user
|
|
51210
|
+
// sends multiple messages withing few milliseconds. E.g. we send a message A
|
|
51211
|
+
// then message B. At first we have message array with both messages of status "sending"
|
|
51212
|
+
// then response for message A is received with a new - later - created_at timestamp
|
|
51213
|
+
// this leads to rearrangement of 1.B ("sending"), 2.A ("received"). Still firstMessageId.current
|
|
51214
|
+
// points to message A, but now this message has index 1 => previousNumItemsPrepended.current === 1
|
|
51215
|
+
// That in turn leads to incorrect index calculation in VirtualizedMessageList trying to access a message
|
|
51216
|
+
// at non-existent index. Therefore, we ignore messages of status "sending" / "failed" in order they are
|
|
51217
|
+
// not considered as prepended messages.
|
|
51218
|
+
if (((_b = messages[i]) === null || _b === void 0 ? void 0 : _b.status) &&
|
|
51219
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
51220
|
+
STATUSES_EXCLUDED_FROM_PREPEND.includes(messages[i].status) &&
|
|
51221
|
+
messages[i].id !== firstMessageId.current) {
|
|
51222
|
+
adjustPrependedMessageCount++;
|
|
51223
|
+
}
|
|
51206
51224
|
if (messages[i].id === firstMessageId.current) {
|
|
51207
|
-
previousNumItemsPrepended.current = i;
|
|
51208
|
-
return
|
|
51225
|
+
previousNumItemsPrepended.current = i - adjustPrependedMessageCount;
|
|
51226
|
+
return previousNumItemsPrepended.current;
|
|
51209
51227
|
}
|
|
51210
51228
|
}
|
|
51211
|
-
// if no match has found, we have jumped - reset the
|
|
51229
|
+
// if no match has found, we have jumped - reset the prepended item count.
|
|
51212
51230
|
firstMessageId.current = currentFirstMessageId;
|
|
51213
51231
|
previousNumItemsPrepended.current = 0;
|
|
51214
51232
|
return 0;
|