Closed Bug 1464876 Opened 6 years ago Closed 5 years ago

Dynamically load reducers in the inspector

Categories

(DevTools :: Inspector, enhancement, P3)

enhancement

Tracking

(firefox77 fixed)

RESOLVED FIXED
Firefox 77
Tracking Status
firefox77 --- fixed

People

(Reporter: gl, Assigned: rcaliman)

References

Details

Attachments

(1 file)

We are spending around 9ms loading all the reducers and combining them in the inspector. We can cut this down by async combining reducers as we need them. For reference, [1] https://stackoverflow.com/questions/32968016/how-to-dynamically-load-reducers-for-code-splitting-in-a-redux-application [2] http://nicolasgallagher.com/redux-modules-and-code-splitting/
Product: Firefox → DevTools

This bug has not been updated in the last 6 months. Resetting the assignee field.
Please, feel free to pick it up again and add a comment outlining your plans for it if you do still intend to work on it.
This is just trying to clean our backlog of bugs and make bugs available for people.

Assignee: gl → nobody
Status: ASSIGNED → NEW

The Inspector loads all its panels' reducers up front, regardless if they're used or not.
Some of the reducers are quite hefty. It seems needless to load and parse code that's not used.

In addition, the reducers are loaded in a different place than their corresponding actions. Actions are loaded and used in the panels, but the reducers are all loaded in the Inpector.
Perhaps it helps readability if actions and reducers are loaded together where they are used, in the sidebar panels.

This patch uses the approach described in the Redux docs to inject reducers on-demand: https://redux.js.org/recipes/code-splitting/#reducer-injection-approaches

There still are reducers which need to load immediately when the Inspector is initialized. But others, like the reducer for the Animations or Fonts panel, are loaded on-demand when the corresponding panels are visible. For the most part, reducers are used in response to actions from their corresponding panels. However, the grid, flexbox and grid highlighter reducers are also used on-demand in HighlightersOverlay.js. In these cases, we load the reducers on-demand even if their corresponding panels haven't been opened yet. When the panels do get opened, the reducers are not re-loaded since they're already available.

Comment on attachment 9133617 [details]
Bug 1464876 - Load reducers on-demand in Inspector sidebar panels

Putting a feedback? on myself to look at this later today. I realized I could miss getting ping'd in phabricator if I don't look at all my emails.

Attachment #9133617 - Flags: feedback?(gl)
Assignee: nobody → rcaliman
Status: NEW → ASSIGNED
Pushed by rcaliman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/286920f15085 Load reducers on-demand in Inspector sidebar panels r=gl
Attachment #9133617 - Flags: feedback?(gl)
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 77
Regressions: 1647989
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: