Created
September 19, 2016 18:22
-
-
Save ConnorRigby/f12c95ee7065aefc399375c60413ea3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is usefull for checking unused reducer functions. | |
const uselessReducerDetector = storeObj => next => action => { | |
let result = next(action); | |
let state1 = storeObj.getState(); | |
let state2 = reducers(state1, result); | |
let isEqual = JSON.stringify(state1) === JSON.stringify(state2); | |
if (isEqual && action.type[0] !== "@") { | |
console.warn(`${action.type} didn't change state. May or may not be useless.`); | |
} else { | |
return result; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment