Skip to content

Commit 4e60c07

Browse files
Merge branch 'release-v11'
2 parents 1800df5 + 1b359f7 commit 4e60c07

File tree

8 files changed

+756
-1367
lines changed

8 files changed

+756
-1367
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ TypingIndicator is rendered as a child of MessageListMainPanel
9191

9292
* remove legacy style components ([#2394](https://github.com/GetStream/stream-chat-react/issues/2394)) ([9410153](https://github.com/GetStream/stream-chat-react/commit/94101535d1de9de23a1ab8913423af0e7009bab9))
9393

94+
## [11.23.5](https://github.com/GetStream/stream-chat-react/compare/v11.23.4...v11.23.5) (2024-08-08)
95+
96+
97+
### Bug Fixes
98+
99+
* do not rerender on client options update ([#2465](https://github.com/GetStream/stream-chat-react/issues/2465)) ([81f33ba](https://github.com/GetStream/stream-chat-react/commit/81f33bae3933c7637e3a2a93b9c53be0511b45f6))
100+
* forward StreamChat constructor options via useCreateChatClient ([#2463](https://github.com/GetStream/stream-chat-react/issues/2463)) ([310835d](https://github.com/GetStream/stream-chat-react/commit/310835dc17e1228cd76d825a1dadb0f681ea552b))
101+
* prevent ChannelPreviews with duplicate keys ([1a075ad](https://github.com/GetStream/stream-chat-react/commit/1a075ad54f834c8a205fd615207e3fde5febf8c2))
102+
94103
## [11.23.4](https://github.com/GetStream/stream-chat-react/compare/v11.23.3...v11.23.4) (2024-08-05)
95104

96105

examples/vite/yarn.lock

+498-601
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"react-popper": "^2.3.0",
9595
"react-textarea-autosize": "^8.3.0",
9696
"react-virtuoso": "^2.16.5",
97-
"remark-gfm": "^4.0.0",
97+
"remark-gfm": "^3.0.1",
9898
"textarea-caret": "^3.1.0",
9999
"tslib": "^2.6.2",
100100
"unist-builder": "^3.0.0",

src/components/ChannelList/ChannelList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ const UnMemoizedChannelList = <
333333
channel: item,
334334
// forces the update of preview component on channel update
335335
channelUpdateCount,
336-
key: item.id,
336+
key: item.cid,
337337
Preview,
338338
setActiveChannel,
339339
watchers,

src/components/Message/renderText/renderText.tsx

+20-16
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ import { find } from 'linkifyjs';
44
import uniqBy from 'lodash.uniqby';
55
import remarkGfm from 'remark-gfm';
66

7+
import type { PluggableList } from 'react-markdown/lib/react-markdown';
8+
import type { UserResponse } from 'stream-chat';
9+
710
import { Anchor, Emoji, Mention, MentionProps } from './componentRenderers';
811
import { detectHttp, escapeRegExp, matchMarkdownLinks, messageCodeBlocks } from './regex';
912
import { emojiMarkdownPlugin, mentionsMarkdownPlugin } from './rehypePlugins';
1013
import { htmlToTextPlugin, keepLineBreaksPlugin } from './remarkPlugins';
14+
import { ErrorBoundary } from '../../UtilityComponents';
1115

12-
import type { PluggableList } from 'react-markdown/lib/react-markdown';
13-
import type { UserResponse } from 'stream-chat';
1416
import type { DefaultStreamChatGenerics } from '../../../types/types';
1517

1618
export type RenderTextPluginConfigurator = (defaultPlugins: PluggableList) => PluggableList;
@@ -158,19 +160,21 @@ export const renderText = <
158160
}
159161

160162
return (
161-
<ReactMarkdown
162-
allowedElements={allowedTagNames}
163-
components={{
164-
...markDownRenderers,
165-
...customMarkDownRenderers,
166-
}}
167-
rehypePlugins={getRehypePlugins(rehypePlugins)}
168-
remarkPlugins={getRemarkPlugins(remarkPlugins)}
169-
skipHtml
170-
transformLinkUri={urlTransform}
171-
unwrapDisallowed
172-
>
173-
{newText}
174-
</ReactMarkdown>
163+
<ErrorBoundary fallback={<>{text}</>}>
164+
<ReactMarkdown
165+
allowedElements={allowedTagNames}
166+
components={{
167+
...markDownRenderers,
168+
...customMarkDownRenderers,
169+
}}
170+
rehypePlugins={getRehypePlugins(rehypePlugins)}
171+
remarkPlugins={getRemarkPlugins(remarkPlugins)}
172+
skipHtml
173+
transformLinkUri={urlTransform}
174+
unwrapDisallowed
175+
>
176+
{newText}
177+
</ReactMarkdown>
178+
</ErrorBoundary>
175179
);
176180
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { Component } from 'react';
2+
import type { PropsWithChildren, ReactNode } from 'react';
3+
4+
type ErrorBoundaryProps = PropsWithChildren<{ fallback?: ReactNode }>;
5+
6+
export class ErrorBoundary extends Component<ErrorBoundaryProps, { hasError: boolean }> {
7+
constructor(props: ErrorBoundaryProps) {
8+
super(props);
9+
this.state = { hasError: false };
10+
}
11+
12+
static getDerivedStateFromError() {
13+
return { hasError: true };
14+
}
15+
16+
componentDidCatch(error: unknown, information: unknown) {
17+
console.error(error, information);
18+
}
19+
20+
render() {
21+
if (this.state.hasError) {
22+
return this.props.fallback;
23+
}
24+
25+
return this.props.children;
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './NullComponent';
2+
export * from './ErrorBoundary';

yarn.lock

+199-748
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)