@copilotz/chat-ui 0.9.23 → 0.9.25
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/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6023,6 +6023,7 @@ var ChatUI = ({
|
|
|
6023
6023
|
isLoadingOlderMessages = false,
|
|
6024
6024
|
hasMoreMessagesBefore = false,
|
|
6025
6025
|
activityNotice = null,
|
|
6026
|
+
isBackgroundRefreshingMessages = false,
|
|
6026
6027
|
callbacks = {},
|
|
6027
6028
|
onLoadOlderMessages,
|
|
6028
6029
|
user,
|
|
@@ -6158,7 +6159,9 @@ var ChatUI = ({
|
|
|
6158
6159
|
prevMessageCountRef.current = groupedMessages.length;
|
|
6159
6160
|
return;
|
|
6160
6161
|
}
|
|
6161
|
-
const
|
|
6162
|
+
const previousMessageCount = prevMessageCountRef.current;
|
|
6163
|
+
const wasEmpty = previousMessageCount === 0;
|
|
6164
|
+
const didAppendMessages = groupedMessages.length > previousMessageCount;
|
|
6162
6165
|
prevMessageCountRef.current = groupedMessages.length;
|
|
6163
6166
|
if (wasEmpty) {
|
|
6164
6167
|
requestAnimationFrame(() => {
|
|
@@ -6170,6 +6173,9 @@ var ChatUI = ({
|
|
|
6170
6173
|
});
|
|
6171
6174
|
return;
|
|
6172
6175
|
}
|
|
6176
|
+
if (isBackgroundRefreshingMessages && !didAppendMessages) {
|
|
6177
|
+
return;
|
|
6178
|
+
}
|
|
6173
6179
|
if (!state.isAtBottom) return;
|
|
6174
6180
|
requestAnimationFrame(() => {
|
|
6175
6181
|
const viewport = scrollAreaRef.current;
|
|
@@ -6180,7 +6186,7 @@ var ChatUI = ({
|
|
|
6180
6186
|
viewport.scrollTop = viewport.scrollHeight;
|
|
6181
6187
|
}
|
|
6182
6188
|
});
|
|
6183
|
-
}, [groupedMessages, state.isAtBottom, virtualizer]);
|
|
6189
|
+
}, [groupedMessages, isBackgroundRefreshingMessages, state.isAtBottom, virtualizer]);
|
|
6184
6190
|
(0, import_react10.useEffect)(() => {
|
|
6185
6191
|
const viewport = scrollAreaRef.current;
|
|
6186
6192
|
if (!viewport) return;
|