Emoji: Fix unneeded re-renders when StatusContent changes (#36532)
This commit is contained in:
parent
97c8cc5606
commit
6e2973aa2d
2 changed files with 9 additions and 5 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue