stream-chat-react 13.2.2 → 13.2.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.
@@ -57,17 +57,21 @@ export const GalleryContainer = ({ attachment, Gallery = DefaultGallery, }) => {
57
57
  const { imageAttachmentSizeHandler } = useChannelStateContext();
58
58
  const [attachmentConfigurations, setAttachmentConfigurations] = useState([]);
59
59
  useLayoutEffect(() => {
60
- if (imageElements.current &&
61
- imageElements.current.every((element) => !!element) &&
62
- imageAttachmentSizeHandler) {
63
- const newConfigurations = [];
64
- imageElements.current.forEach((element, i) => {
65
- const config = imageAttachmentSizeHandler(attachment.images[i], element);
66
- newConfigurations.push(config);
67
- });
68
- setAttachmentConfigurations(newConfigurations);
60
+ if (!imageElements.current || !imageAttachmentSizeHandler)
61
+ return;
62
+ const newConfigurations = [];
63
+ const nonNullImageElements = imageElements.current.filter((e) => !!e);
64
+ if (nonNullImageElements.length < imageElements.current.length) {
65
+ imageElements.current = nonNullImageElements;
69
66
  }
70
- }, [imageElements, imageAttachmentSizeHandler, attachment]);
67
+ imageElements.current.forEach((element, i) => {
68
+ if (!element)
69
+ return;
70
+ const config = imageAttachmentSizeHandler(attachment.images[i], element);
71
+ newConfigurations.push(config);
72
+ });
73
+ setAttachmentConfigurations(newConfigurations);
74
+ }, [imageAttachmentSizeHandler, attachment]);
71
75
  const images = attachment.images.map((image, i) => ({
72
76
  ...image,
73
77
  previewUrl: attachmentConfigurations[i]?.url || 'about:blank',
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
24
24
  useEffect(() => {
25
25
  if (!client)
26
26
  return;
27
- const version = "13.2.2";
27
+ const version = "13.2.3";
28
28
  const userAgent = client.getUserAgent();
29
29
  if (!userAgent.includes('stream-chat-react')) {
30
30
  // result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
@@ -3,6 +3,7 @@ export * from './hooks';
3
3
  export * from './icons';
4
4
  export * from './Message';
5
5
  export * from './MessageDeleted';
6
+ export * from './MessageIsThreadReplyInChannelButtonIndicator';
6
7
  export * from './MessageOptions';
7
8
  export * from './MessageRepliesCountButton';
8
9
  export * from './MessageSimple';
@@ -3,6 +3,7 @@ export * from './hooks';
3
3
  export * from './icons';
4
4
  export * from './Message';
5
5
  export * from './MessageDeleted';
6
+ export * from './MessageIsThreadReplyInChannelButtonIndicator';
6
7
  export * from './MessageOptions';
7
8
  export * from './MessageRepliesCountButton';
8
9
  export * from './MessageSimple';
@@ -402,6 +402,7 @@ __export(src_exports, {
402
402
  MessageInputContext: () => MessageInputContext,
403
403
  MessageInputContextProvider: () => MessageInputContextProvider,
404
404
  MessageInputFlat: () => MessageInputFlat,
405
+ MessageIsThreadReplyInChannelButtonIndicator: () => MessageIsThreadReplyInChannelButtonIndicator,
405
406
  MessageList: () => MessageList,
406
407
  MessageListContext: () => MessageListContext,
407
408
  MessageListContextProvider: () => MessageListContextProvider,
@@ -33280,15 +33281,19 @@ var GalleryContainer = ({
33280
33281
  const { imageAttachmentSizeHandler } = useChannelStateContext();
33281
33282
  const [attachmentConfigurations, setAttachmentConfigurations] = (0, import_react259.useState)([]);
33282
33283
  (0, import_react259.useLayoutEffect)(() => {
33283
- if (imageElements.current && imageElements.current.every((element4) => !!element4) && imageAttachmentSizeHandler) {
33284
- const newConfigurations = [];
33285
- imageElements.current.forEach((element4, i) => {
33286
- const config = imageAttachmentSizeHandler(attachment.images[i], element4);
33287
- newConfigurations.push(config);
33288
- });
33289
- setAttachmentConfigurations(newConfigurations);
33290
- }
33291
- }, [imageElements, imageAttachmentSizeHandler, attachment]);
33284
+ if (!imageElements.current || !imageAttachmentSizeHandler) return;
33285
+ const newConfigurations = [];
33286
+ const nonNullImageElements = imageElements.current.filter((e) => !!e);
33287
+ if (nonNullImageElements.length < imageElements.current.length) {
33288
+ imageElements.current = nonNullImageElements;
33289
+ }
33290
+ imageElements.current.forEach((element4, i) => {
33291
+ if (!element4) return;
33292
+ const config = imageAttachmentSizeHandler(attachment.images[i], element4);
33293
+ newConfigurations.push(config);
33294
+ });
33295
+ setAttachmentConfigurations(newConfigurations);
33296
+ }, [imageAttachmentSizeHandler, attachment]);
33292
33297
  const images = attachment.images.map((image3, i) => ({
33293
33298
  ...image3,
33294
33299
  previewUrl: attachmentConfigurations[i]?.url || "about:blank",
@@ -35001,7 +35006,7 @@ var useChat = ({
35001
35006
  };
35002
35007
  (0, import_react269.useEffect)(() => {
35003
35008
  if (!client) return;
35004
- const version = "13.2.2";
35009
+ const version = "13.2.3";
35005
35010
  const userAgent = client.getUserAgent();
35006
35011
  if (!userAgent.includes("stream-chat-react")) {
35007
35012
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);