Page MenuHomePhabricator

D6765.id22774.diff
No OneTemporary

D6765.id22774.diff

diff --git a/web/chat/chat-message-list.react.js b/web/chat/chat-message-list.react.js
--- a/web/chat/chat-message-list.react.js
+++ b/web/chat/chat-message-list.react.js
@@ -315,7 +315,7 @@
const { clearTooltip } = useTooltipContext();
- const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadInfo.id);
+ const getTextMessageMarkdownRules = useTextMessageRulesFunc(threadInfo);
const messageListContext = React.useMemo(() => {
if (!getTextMessageMarkdownRules) {
return undefined;
diff --git a/web/markdown/rules.react.js b/web/markdown/rules.react.js
--- a/web/markdown/rules.react.js
+++ b/web/markdown/rules.react.js
@@ -4,12 +4,10 @@
import * as React from 'react';
import * as SimpleMarkdown from 'simple-markdown';
-import { relativeMemberInfoSelectorForMembersOfThread } from 'lib/selectors/user-selectors.js';
import * as SharedMarkdown from 'lib/shared/markdown.js';
-import type { RelativeMemberInfo } from 'lib/types/thread-types.js';
+import type { RelativeMemberInfo, ThreadInfo } from 'lib/types/thread-types.js';
import MarkdownSpoiler from './markdown-spoiler.react.js';
-import { useSelector } from '../redux/redux-utils.js';
export type MarkdownRules = {
+simpleMarkdownRules: SharedMarkdown.ParserRules,
@@ -160,19 +158,16 @@
});
function useTextMessageRulesFunc(
- threadID: ?string,
-): ?(boolean) => MarkdownRules {
- const threadMembers = useSelector(
- relativeMemberInfoSelectorForMembersOfThread(threadID),
+ threadInfo: ThreadInfo,
+): boolean => MarkdownRules {
+ const { members } = threadInfo;
+ return React.useMemo(
+ () =>
+ _memoize<[boolean], MarkdownRules>((useDarkStyle: boolean) =>
+ textMessageRules(members, useDarkStyle),
+ ),
+ [members],
);
- return React.useMemo(() => {
- if (!threadMembers) {
- return undefined;
- }
- return _memoize<[boolean], MarkdownRules>((useDarkStyle: boolean) =>
- textMessageRules(threadMembers, useDarkStyle),
- );
- }, [threadMembers]);
}
function textMessageRules(

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 5:24 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2495550
Default Alt Text
D6765.id22774.diff (2 KB)

Event Timeline