Skip to content

Commit

Permalink
Merge branch 'release-v11'
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Aug 15, 2024
2 parents 1800df5 + 1b359f7 commit 4e60c07
Show file tree
Hide file tree
Showing 8 changed files with 756 additions and 1,367 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ TypingIndicator is rendered as a child of MessageListMainPanel

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

## [11.23.5](https://github.com/GetStream/stream-chat-react/compare/v11.23.4...v11.23.5) (2024-08-08)


### Bug Fixes

* 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))
* 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))
* prevent ChannelPreviews with duplicate keys ([1a075ad](https://github.com/GetStream/stream-chat-react/commit/1a075ad54f834c8a205fd615207e3fde5febf8c2))

## [11.23.4](https://github.com/GetStream/stream-chat-react/compare/v11.23.3...v11.23.4) (2024-08-05)


Expand Down
1,099 changes: 498 additions & 601 deletions examples/vite/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"react-popper": "^2.3.0",
"react-textarea-autosize": "^8.3.0",
"react-virtuoso": "^2.16.5",
"remark-gfm": "^4.0.0",
"remark-gfm": "^3.0.1",
"textarea-caret": "^3.1.0",
"tslib": "^2.6.2",
"unist-builder": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChannelList/ChannelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const UnMemoizedChannelList = <
channel: item,
// forces the update of preview component on channel update
channelUpdateCount,
key: item.id,
key: item.cid,
Preview,
setActiveChannel,
watchers,
Expand Down
36 changes: 20 additions & 16 deletions src/components/Message/renderText/renderText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { find } from 'linkifyjs';
import uniqBy from 'lodash.uniqby';
import remarkGfm from 'remark-gfm';

import type { PluggableList } from 'react-markdown/lib/react-markdown';
import type { UserResponse } from 'stream-chat';

import { Anchor, Emoji, Mention, MentionProps } from './componentRenderers';
import { detectHttp, escapeRegExp, matchMarkdownLinks, messageCodeBlocks } from './regex';
import { emojiMarkdownPlugin, mentionsMarkdownPlugin } from './rehypePlugins';
import { htmlToTextPlugin, keepLineBreaksPlugin } from './remarkPlugins';
import { ErrorBoundary } from '../../UtilityComponents';

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

export type RenderTextPluginConfigurator = (defaultPlugins: PluggableList) => PluggableList;
Expand Down Expand Up @@ -158,19 +160,21 @@ export const renderText = <
}

return (
<ReactMarkdown
allowedElements={allowedTagNames}
components={{
...markDownRenderers,
...customMarkDownRenderers,
}}
rehypePlugins={getRehypePlugins(rehypePlugins)}
remarkPlugins={getRemarkPlugins(remarkPlugins)}
skipHtml
transformLinkUri={urlTransform}
unwrapDisallowed
>
{newText}
</ReactMarkdown>
<ErrorBoundary fallback={<>{text}</>}>
<ReactMarkdown
allowedElements={allowedTagNames}
components={{
...markDownRenderers,
...customMarkDownRenderers,
}}
rehypePlugins={getRehypePlugins(rehypePlugins)}
remarkPlugins={getRemarkPlugins(remarkPlugins)}
skipHtml
transformLinkUri={urlTransform}
unwrapDisallowed
>
{newText}
</ReactMarkdown>
</ErrorBoundary>
);
};
27 changes: 27 additions & 0 deletions src/components/UtilityComponents/ErrorBoundary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Component } from 'react';
import type { PropsWithChildren, ReactNode } from 'react';

type ErrorBoundaryProps = PropsWithChildren<{ fallback?: ReactNode }>;

export class ErrorBoundary extends Component<ErrorBoundaryProps, { hasError: boolean }> {
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = { hasError: false };
}

static getDerivedStateFromError() {
return { hasError: true };
}

componentDidCatch(error: unknown, information: unknown) {
console.error(error, information);
}

render() {
if (this.state.hasError) {
return this.props.fallback;
}

return this.props.children;
}
}
1 change: 1 addition & 0 deletions src/components/UtilityComponents/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './NullComponent';
export * from './ErrorBoundary';
947 changes: 199 additions & 748 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 4e60c07

Please sign in to comment.