![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
redux-usage-report
Advanced tools
A Redux devtools monitor focused on your app's usage of the Redux store
This library tracks the way your app is actually using the data in your Redux store. By setting up the monitor in devtools you can see a live view of when different parts of your store are accessed:
If you want to know exactly when a certain value is being accessed, you can set a breakpoint to explore the call stack when the app touches that particular value.
Try it out on the TodoMVC app here.
yarn install redux-usage-report redux-devtools redux-devtools-dock-monitor
DevTools.js
import React from 'react';
import { createDevTools } from 'redux-devtools';
import DockMonitor from 'redux-devtools-dock-monitor';
import { UsageMonitor } from 'redux-usage-report';
export default createDevTools(
<DockMonitor toggleVisibilityKey='ctrl-h'
changePositionKey='ctrl-q'
changeMonitorKey='ctrl-m'>
<UsageMonitor />
</DockMonitor>
);
generateReduxReport
and the DevTools.instrument
store enhancersMake sure to put the DevTools.instrument()
call last in the order of composed functions.
configureStore.js
import { createStore, applyMiddleware, compose } from "redux"
import rootReducer from "platform/state/reducers"
import generateReduxReport from "redux-usage-report"
import DevTools from '../DevTools';
const enhancer = compose(
generateReduxReport(),
// DevTools.instrument() should go last
DevTools.instrument()
)
const store = createStore(rootReducer, initialState, enhancer)
<DevTools/>
into the appThe easiest way to do this is just render the <DevTools/>
component in your App component.
Read more about setting up redux devtools in the official documentation.
Please make sure to only include the devtools for your development build!
The json view of your store will show the parts that have been not accessed at reduced opacity, as well as an estimate of the total percentage of your store that has been used so far by your app.
You can set a breakpoint by doing shift + click
on any key in the json view. The next time the key is accessed, the debugger will stop execution. Feel free to reload the page, the breakpoint will persist until you remove it by holding shift
and clicking it again.
The generateReduxReport
enhancer wraps the store in a proxy, so that each object access can be tracked.
It tries to be smart about ignoring object accesses that come from outside your app's code. For instance, if you're also using the persistStore
Devtools plugin, even though that plugin accesses every key in your store, you shouldn't see that reflected in the Usage Report monitor. The monitor attempts to filter out object access that originates in any module located in the node_modules
folder or from a browser extension. This filtering logic only works in Chrome, or failing that, if you are using something like the eval option or some other lightweight type of source map that preserves file pathnames in stacktraces.
If you are curious as to why a value is marked "accessed", you can always shift + click
the relevant key in the monitor to set a breakpoint.
If you notice any performance issues, you can speed things up by turning off the most expensive check (whether to ignore object access that originates from node_modules
) by typing in the console:
reduxReport.__skipAccessOriginCheck = true
FAQs
A Redux devtools monitor focused on your app's usage of the Redux store
The npm package redux-usage-report receives a total of 2 weekly downloads. As such, redux-usage-report popularity was classified as not popular.
We found that redux-usage-report demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.