stream-chat-react 13.6.0 → 13.6.2

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.
@@ -16246,13 +16246,13 @@ var getMessageActions = (actions, {
16246
16246
  if (canReact && messageActions.indexOf(MESSAGE_ACTIONS.react) > -1) {
16247
16247
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.react);
16248
16248
  }
16249
- if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe)) {
16249
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe) > -1) {
16250
16250
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.remindMe);
16251
16251
  }
16252
16252
  if (canReply && messageActions.indexOf(MESSAGE_ACTIONS.reply) > -1) {
16253
16253
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.reply);
16254
16254
  }
16255
- if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater)) {
16255
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater) > -1) {
16256
16256
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.saveForLater);
16257
16257
  }
16258
16258
  return messageActionsAfterPermission;
@@ -33409,7 +33409,6 @@ var TextareaComposer = ({
33409
33409
  event.preventDefault();
33410
33410
  }
33411
33411
  handleSubmit();
33412
- textareaRef.current.selectionEnd = 0;
33413
33412
  }
33414
33413
  },
33415
33414
  [
@@ -33432,7 +33431,7 @@ var TextareaComposer = ({
33432
33431
  },
33433
33432
  [onScroll, textComposer]
33434
33433
  );
33435
- const setSelectionDebounced = (0, import_react255.useCallback)(
33434
+ const setSelection = (0, import_react255.useCallback)(
33436
33435
  (e) => {
33437
33436
  onSelect?.(e);
33438
33437
  textComposer.setSelection({
@@ -33442,12 +33441,6 @@ var TextareaComposer = ({
33442
33441
  },
33443
33442
  [onSelect, textComposer]
33444
33443
  );
33445
- (0, import_react255.useEffect)(() => {
33446
- if (textareaRef.current && !isComposing) {
33447
- textareaRef.current.selectionStart = selection.start;
33448
- textareaRef.current.selectionEnd = selection.end;
33449
- }
33450
- }, [text7, textareaRef, selection.start, selection.end, isComposing]);
33451
33444
  (0, import_react255.useEffect)(() => {
33452
33445
  if (textComposer.suggestions) {
33453
33446
  setFocusedItemIndex(0);
@@ -33458,11 +33451,18 @@ var TextareaComposer = ({
33458
33451
  if (!textareaRef.current || textareaIsFocused || !focus) return;
33459
33452
  textareaRef.current.focus();
33460
33453
  }, [attachments, focus, quotedMessage, textareaRef]);
33461
- (0, import_react255.useEffect)(() => {
33454
+ (0, import_react255.useLayoutEffect)(() => {
33462
33455
  const textarea = textareaRef.current;
33463
- if (!textarea) return;
33464
- textarea.value = text7;
33465
- }, [textareaRef, text7]);
33456
+ if (!textarea || isComposing) return;
33457
+ if (textarea.value !== text7) {
33458
+ textarea.value = text7;
33459
+ }
33460
+ const length = textarea.value.length;
33461
+ const start2 = Math.max(0, Math.min(selection.start, length));
33462
+ const end = Math.max(start2, Math.min(selection.end, length));
33463
+ if (textarea.selectionStart === start2 && textarea.selectionEnd === end) return;
33464
+ textarea.setSelectionRange(start2, end, "forward");
33465
+ }, [text7, selection.start, selection.end, isComposing, textareaRef]);
33466
33466
  return /* @__PURE__ */ import_react255.default.createElement(
33467
33467
  "div",
33468
33468
  {
@@ -33497,7 +33497,7 @@ var TextareaComposer = ({
33497
33497
  onKeyDown: keyDownHandler,
33498
33498
  onPaste,
33499
33499
  onScroll: scrollHandler,
33500
- onSelect: setSelectionDebounced,
33500
+ onSelect: setSelection,
33501
33501
  placeholder: placeholder || t("Type your message"),
33502
33502
  ref: (ref) => {
33503
33503
  textareaRef.current = ref;
@@ -36117,7 +36117,7 @@ var useChat = ({
36117
36117
  };
36118
36118
  (0, import_react282.useEffect)(() => {
36119
36119
  if (!client) return;
36120
- const version = "13.6.0";
36120
+ const version = "13.6.2";
36121
36121
  const userAgent = client.getUserAgent();
36122
36122
  if (!userAgent.includes("stream-chat-react")) {
36123
36123
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);