v0.11.7
add logicMiddleware.addDeps(additionalDeps)
Add a method addDeps
to the logicMiddleware that will allow the injection of additional dependencies that will be available to the hooks (validate/transform/process).
It must be called after the store is created so that everything initializes properly.
It will verify that it is not overriding existing dependencies (unless they are the exact same value/instance), throwing an error if it finds a conflict. This will help prevent accidental collisions which would manifest as strange errors.
const deps = { a: 1 };
const logicMiddleware = createLogicMiddleware(logic, deps);
const store = createStore(reducer, applyMiddleware(logicMiddleware));
logicMiddleware.addDeps({ b: 2 }); // now deps are { a: 1, b: 2 }
logicMiddleware.addDeps({ b: 2 }); // ok, override with same value
logicMiddleware.addDeps({ b: 3 }); // throws an error, cannot override