-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
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 Owner
Current Issue Owner: @muttmuureMetadata
Metadata
Labels
Type
Projects
Status