mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-27 11:20:28 +00:00
Updated snapshots due to the upgrade and failing ExplorerPanel test. This was due to the shallow call being made earlier than defining the document.body Update to React 16 Update other dependencies Stylelint updates Remove unused imports Update babel and gulp packages Update package-lock
33 lines
769 B
JavaScript
33 lines
769 B
JavaScript
/* eslint-disable import/no-mutable-exports */
|
|
let perfMiddleware;
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
/**
|
|
* Performance middleware for use with a Redux store.
|
|
* Will log the time taken by every action across all
|
|
* of the reducers of the store.
|
|
*/
|
|
perfMiddleware = () => {
|
|
/* eslint-disable no-console */
|
|
// `next` is a function that takes an 'action' and sends it through to the 'reducers'.
|
|
const middleware = (next) => (action) => {
|
|
let result;
|
|
|
|
if (!!console.time) {
|
|
console.time(action.type);
|
|
result = next(action);
|
|
console.timeEnd(action.type);
|
|
} else {
|
|
result = next(action);
|
|
}
|
|
|
|
return result;
|
|
};
|
|
|
|
return middleware;
|
|
};
|
|
}
|
|
|
|
export {
|
|
perfMiddleware,
|
|
};
|