Skip to content

[HOLD for payment 2023-11-06] Refactor EmojiPickerMenu component for web to avoid unnecessary rerenders #29004

@mountiny

Description

@mountiny

Coming from here

Proposal

Refactor EmojiPickerMenu component for web to avoid unnecessary rerenders

Problem

Currently, the logic responsible for highlighting the emoji on hover is living in EmojiPickerMenu component, which contains a highlightedIndex state, keeping the index number of emoji that need to be highlighted. Since this index changes each time user hovers in/hovers out, it causes rerender of whole EmojiPickerMenu component (see video 1 - console is showing the amount of EmojiPickerMenu rerenders and the rendered components are highlighted in the browser).

Solution

To address this issue, the logic for highlighting should be moved to EmojiPickerMenuItem component to rerender only the hovered component. This will prevent the whole EmojiPickerMenu from rerendering (see video 2 - console is showing the amount of EmojiPickerMenu rerenders and the rendered components are highlighted in the browser).
Also attaching screenshots from the profiler - you can see that originally the whole picker menu is rerendering on each hover change, and after fixing it the only thing that gets rerendered is a single menu item.

Issue OwnerCurrent Issue Owner: @muttmuure

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions