Created
January 25, 2017 14:36
-
-
Save TobyEalden/010a7590e5418fd9f1852bd550547764 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
/* | |
* BEFORE | |
*/ | |
import {dataLoader} from "nqm-app-framework"; | |
//... | |
export default dataLoader.merge( | |
dataLoader.compose(dataLoader.trackerFactory(dataMapper), {propsToWatch: ["parentId"]}), | |
dataLoader.compose(dataLoader.reduxFactory(stateMapper)), | |
dataLoader.useDeps(depsMapper) | |
)(ResourceExplorer); | |
/* | |
* AFTER | |
*/ | |
import {dataLoader, optionsWithError} from "app-data-loader"; | |
//... | |
export default dataLoader.merge( | |
dataLoader.compose(dataLoader.trackerFactory(dataMapper), optionsWithError({propsToWatch: ["parentId"]})), | |
dataLoader.compose(dataLoader.reduxFactory(stateMapper)), | |
dataLoader.useDeps(depsMapper) | |
)(ResourceExplorer); | |
/* | |
* app-data-loader.js | |
*/ | |
import {dataLoader} from "nqm-app-framework"; | |
const myPrettyErrorFunk = function() { | |
//... | |
} | |
const optionsWithError = function(opts, customErrorHandler) { | |
return _.extend(opts, {errorHandler: customErrorHandler || myPrettyErrorFunk}); | |
} | |
export {dataLoader, optionsWithError} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment