mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
da154ce911
The Inspector [loads all its panels' Redux reducers](https://searchfox.org/mozilla-central/source/devtools/client/inspector/reducers.js) 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 needed. 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 when creating the store](https://searchfox.org/mozilla-central/rev/d69ec052bed8700af7a283e37b60b4af22734930/devtools/client/inspector/store.js#8,11). It helps reduce the cognitive load 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 (mostly related to the Rules panel). 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 in HighlightersOverlay.js](https://searchfox.org/mozilla-central/rev/d69ec052bed8700af7a283e37b60b4af22734930/devtools/client/inspector/shared/highlighters-overlay.js#502) to provide highlighters with configuration or node context. 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. Differential Revision: https://phabricator.services.mozilla.com/D67008 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
actions | ||
components | ||
reducers | ||
test | ||
utils | ||
animation.js | ||
current-time-timer.js | ||
moz.build |