2
0

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
parent 97c8cc5606
commit 6e2973aa2d
2 changed files with 9 additions and 5 deletions

View File

@@ -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}

View File

@@ -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(