Emoji: Fix unneeded re-renders when StatusContent changes (#36532)
This commit is contained in:
@@ -269,7 +269,7 @@ class StatusContent extends PureComponent {
|
|||||||
lang={language}
|
lang={language}
|
||||||
htmlString={content}
|
htmlString={content}
|
||||||
extraEmojis={status.get('emojis')}
|
extraEmojis={status.get('emojis')}
|
||||||
onElement={this.handleElement.bind(this)}
|
onElement={this.handleElement}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{poll}
|
{poll}
|
||||||
@@ -287,7 +287,7 @@ class StatusContent extends PureComponent {
|
|||||||
lang={language}
|
lang={language}
|
||||||
htmlString={content}
|
htmlString={content}
|
||||||
extraEmojis={status.get('emojis')}
|
extraEmojis={status.get('emojis')}
|
||||||
onElement={this.handleElement.bind(this)}
|
onElement={this.handleElement}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{poll}
|
{poll}
|
||||||
|
|||||||
@@ -46,11 +46,15 @@ export const EmbeddedStatusContent: React.FC<{
|
|||||||
() => (status.get('mentions') as List<Mention>).toJS(),
|
() => (status.get('mentions') as List<Mention>).toJS(),
|
||||||
[status],
|
[status],
|
||||||
);
|
);
|
||||||
const htmlHandlers = useElementHandledLink({
|
const hrefToMention = useCallback(
|
||||||
hashtagAccountId: status.get('account') as string | undefined,
|
(href: string) => {
|
||||||
hrefToMention(href) {
|
|
||||||
return mentions.find((item) => item.url === href);
|
return mentions.find((item) => item.url === href);
|
||||||
},
|
},
|
||||||
|
[mentions],
|
||||||
|
);
|
||||||
|
const htmlHandlers = useElementHandledLink({
|
||||||
|
hashtagAccountId: status.get('account') as string | undefined,
|
||||||
|
hrefToMention,
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleContentRef = useCallback(
|
const handleContentRef = useCallback(
|
||||||
|
|||||||
Reference in New Issue
Block a user