Tab react components render at almost any state change
Categories
(DevTools :: Debugger, enhancement)
Tracking
(firefox116 fixed)
Tracking | Status | |
---|---|---|
firefox116 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
Attachments
(5 files)
The Tabs and Tab components currently re-render for almost all state changes because of lack of correct memoization of selectors, but also because <Tab> is being given props which always change (onDrag* event handler). Then they are all updated unecessarily because they have selectedLocation as prop, whereas it only impact deselected and newly selected tabs only.
Assignee | ||
Comment 1•2 years ago
|
||
This was calling outdated selector name and wrong argument were passed to the action.
While I'm reading this code, also fix disabled state of two other context menus.
And also disable them based on Tab source rather than the selected source!
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
This isn't enough to stop all unecessary Tab updates, but may help cut a few.
Each time Tabs re-rendered, all Tab children component were forced to re-render
because all these onDrag* props were new objects.
Assignee | ||
Comment 3•2 years ago
|
||
Assignee | ||
Comment 4•2 years ago
|
||
Computing the "isActive" field from the selector allows to update the component
only when the related source becomes selected or stops being selected.
Also, activeSearch being set to "source" no longer exists.
Last but not least, tweak Tab's key property to be unique per tab.
Using 'index' is wrong, when moving or adding tab first, it will change all Tab's state!
With all these patches, now, when you have more than two tabs,
when selecting another tab, only two Tab components gets re-rendered:
the old and the new being selected.
Assignee | ||
Comment 5•2 years ago
|
||
Sometimes the UI code emit an undefined new index.
Comment 7•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/df036e39dd8c
https://hg.mozilla.org/mozilla-central/rev/d36f1aac82d0
https://hg.mozilla.org/mozilla-central/rev/514dc1087d5b
https://hg.mozilla.org/mozilla-central/rev/6fb412d1fc55
https://hg.mozilla.org/mozilla-central/rev/bd2bde7ae3a9
Description
•