@landtrustinc/design-system 1.2.64 → 1.2.65

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.js CHANGED
@@ -6987,8 +6987,8 @@ var useChatScrollControl = ({
6987
6987
  }) => {
6988
6988
  const scrollRef = (0, import_react39.useRef)(null);
6989
6989
  const savedScrollPosition = (0, import_react39.useRef)(0);
6990
- const previousMessagesLength = (0, import_react39.useRef)(messages.length);
6991
- const previousMessagesRef = (0, import_react39.useRef)(messages);
6990
+ const previousMessagesLengthRef = (0, import_react39.useRef)(messages.length);
6991
+ const previousIsThinkingRef = (0, import_react39.useRef)(isThinking);
6992
6992
  const userJustSentMessageRef = (0, import_react39.useRef)(false);
6993
6993
  const [isAtBottom, setIsAtBottom] = (0, import_react39.useState)(true);
6994
6994
  const [showScrollButton, setShowScrollButton] = (0, import_react39.useState)(false);
@@ -7044,11 +7044,11 @@ var useChatScrollControl = ({
7044
7044
  const el = scrollRef.current;
7045
7045
  if (!el || !isExpanded)
7046
7046
  return;
7047
- const messagesLengthChanged = messages.length !== previousMessagesLength.current;
7048
- const messagesContentChanged = messages !== previousMessagesRef.current;
7049
- previousMessagesLength.current = messages.length;
7050
- previousMessagesRef.current = messages;
7051
- if (messagesLengthChanged || messagesContentChanged || isThinking) {
7047
+ const messagesAdded = messages.length !== previousMessagesLengthRef.current;
7048
+ previousMessagesLengthRef.current = messages.length;
7049
+ const thinkingStarted = isThinking && !previousIsThinkingRef.current;
7050
+ previousIsThinkingRef.current = isThinking;
7051
+ if (messagesAdded || thinkingStarted) {
7052
7052
  if (!enableScrollToBottomControl) {
7053
7053
  requestAnimationFrame(() => {
7054
7054
  scrollToBottom("smooth");
@@ -7067,7 +7067,7 @@ var useChatScrollControl = ({
7067
7067
  }
7068
7068
  userJustSentMessageRef.current = false;
7069
7069
  }, [
7070
- messages,
7070
+ messages.length,
7071
7071
  isThinking,
7072
7072
  isExpanded,
7073
7073
  isAtBottom,