stream-chat-react 13.6.0 → 13.6.1

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.
@@ -18116,13 +18116,13 @@ var getMessageActions = (actions, {
18116
18116
  if (canReact && messageActions.indexOf(MESSAGE_ACTIONS.react) > -1) {
18117
18117
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.react);
18118
18118
  }
18119
- if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe)) {
18119
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.remindMe) > -1) {
18120
18120
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.remindMe);
18121
18121
  }
18122
18122
  if (canReply && messageActions.indexOf(MESSAGE_ACTIONS.reply) > -1) {
18123
18123
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.reply);
18124
18124
  }
18125
- if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater)) {
18125
+ if (channelConfig?.["user_message_reminders"] && messageActions.indexOf(MESSAGE_ACTIONS.saveForLater) > -1) {
18126
18126
  messageActionsAfterPermission.push(MESSAGE_ACTIONS.saveForLater);
18127
18127
  }
18128
18128
  return messageActionsAfterPermission;
@@ -35279,7 +35279,6 @@ var TextareaComposer = ({
35279
35279
  event.preventDefault();
35280
35280
  }
35281
35281
  handleSubmit();
35282
- textareaRef.current.selectionEnd = 0;
35283
35282
  }
35284
35283
  },
35285
35284
  [
@@ -35302,7 +35301,7 @@ var TextareaComposer = ({
35302
35301
  },
35303
35302
  [onScroll, textComposer]
35304
35303
  );
35305
- const setSelectionDebounced = (0, import_react255.useCallback)(
35304
+ const setSelection = (0, import_react255.useCallback)(
35306
35305
  (e) => {
35307
35306
  onSelect?.(e);
35308
35307
  textComposer.setSelection({
@@ -35312,12 +35311,6 @@ var TextareaComposer = ({
35312
35311
  },
35313
35312
  [onSelect, textComposer]
35314
35313
  );
35315
- (0, import_react255.useEffect)(() => {
35316
- if (textareaRef.current && !isComposing) {
35317
- textareaRef.current.selectionStart = selection.start;
35318
- textareaRef.current.selectionEnd = selection.end;
35319
- }
35320
- }, [text7, textareaRef, selection.start, selection.end, isComposing]);
35321
35314
  (0, import_react255.useEffect)(() => {
35322
35315
  if (textComposer.suggestions) {
35323
35316
  setFocusedItemIndex(0);
@@ -35328,11 +35321,15 @@ var TextareaComposer = ({
35328
35321
  if (!textareaRef.current || textareaIsFocused || !focus) return;
35329
35322
  textareaRef.current.focus();
35330
35323
  }, [attachments, focus, quotedMessage, textareaRef]);
35331
- (0, import_react255.useEffect)(() => {
35324
+ (0, import_react255.useLayoutEffect)(() => {
35332
35325
  const textarea = textareaRef.current;
35333
- if (!textarea) return;
35334
- textarea.value = text7;
35335
- }, [textareaRef, text7]);
35326
+ if (!textarea || isComposing) return;
35327
+ const length = textarea.value.length;
35328
+ const start2 = Math.max(0, Math.min(selection.start, length));
35329
+ const end = Math.max(start2, Math.min(selection.end, length));
35330
+ if (textarea.selectionStart === start2 && textarea.selectionEnd === end) return;
35331
+ textarea.setSelectionRange(start2, end, "forward");
35332
+ }, [text7, selection.start, selection.end, isComposing, textareaRef]);
35336
35333
  return /* @__PURE__ */ import_react255.default.createElement(
35337
35334
  "div",
35338
35335
  {
@@ -35367,11 +35364,12 @@ var TextareaComposer = ({
35367
35364
  onKeyDown: keyDownHandler,
35368
35365
  onPaste,
35369
35366
  onScroll: scrollHandler,
35370
- onSelect: setSelectionDebounced,
35367
+ onSelect: setSelection,
35371
35368
  placeholder: placeholder || t("Type your message"),
35372
35369
  ref: (ref) => {
35373
35370
  textareaRef.current = ref;
35374
- }
35371
+ },
35372
+ value: text7
35375
35373
  }
35376
35374
  ),
35377
35375
  !isComposing && /* @__PURE__ */ import_react255.default.createElement(
@@ -37987,7 +37985,7 @@ var useChat = ({
37987
37985
  };
37988
37986
  (0, import_react282.useEffect)(() => {
37989
37987
  if (!client) return;
37990
- const version = "13.6.0";
37988
+ const version = "13.6.1";
37991
37989
  const userAgent = client.getUserAgent();
37992
37990
  if (!userAgent.includes("stream-chat-react")) {
37993
37991
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);