Emoji: Fix unneeded re-renders when StatusContent changes (#36532)

This commit is contained in:
Echo 2025-10-20 16:52:27 +02:00 committed by GitHub
commit 6e2973aa2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -269,7 +269,7 @@ class StatusContent extends PureComponent {
lang={language}
htmlString={content}
extraEmojis={status.get('emojis')}
onElement={this.handleElement.bind(this)}
onElement={this.handleElement}
/>
{poll}
@ -287,7 +287,7 @@ class StatusContent extends PureComponent {
lang={language}
htmlString={content}
extraEmojis={status.get('emojis')}
onElement={this.handleElement.bind(this)}
onElement={this.handleElement}
/>
{poll}

View file

@ -46,11 +46,15 @@ export const EmbeddedStatusContent: React.FC<{
() => (status.get('mentions') as List<Mention>).toJS(),
[status],
);
const htmlHandlers = useElementHandledLink({
hashtagAccountId: status.get('account') as string | undefined,
hrefToMention(href) {
const hrefToMention = useCallback(
(href: string) => {
return mentions.find((item) => item.url === href);
},
[mentions],
);
const htmlHandlers = useElementHandledLink({
hashtagAccountId: status.get('account') as string | undefined,
hrefToMention,
});
const handleContentRef = useCallback(