Skip to content

Commit

Permalink
small tweak to allow changing the running saga within hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenKiwi committed Feb 2, 2020
1 parent f4accd7 commit 9efd162
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,5 +1,5 @@
{
"name": "redux-injectors",
"name": "@the-coin/redux-injectors",
"version": "1.3.0",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand Down
6 changes: 3 additions & 3 deletions src/injectSaga.js
Expand Up @@ -84,11 +84,11 @@ export default ({ key, saga, mode }) => WrappedComponent => {
const useInjectSaga = ({ key, saga, mode }) => {
const store = useStore();

const isInjected = React.useRef(false);
const isInjected = React.useRef(undefined);

if (!isInjected.current) {
if (isInjected.current != key) {
getInjectors(store).injectSaga(key, { saga, mode });
isInjected.current = true;
isInjected.current = key;
}

React.useEffect(
Expand Down

0 comments on commit 9efd162

Please sign in to comment.