redux-injector icon indicating copy to clipboard operation
redux-injector copied to clipboard

injectReducer force parameter

Open GuillaumeCisco opened this issue 8 years ago • 1 comments

Hey there,

I see in the source code:

export function injectReducer(key, reducer, force = false) {
  // If already set, do nothing.
  if (has(store.injectedReducers, key) || force) return;

  set(store.injectedReducers, key, reducer);
  store.replaceReducer(combineReducersRecurse(store.injectedReducers));
}

What is the purpose of the force parameter? If injectedReducers has the reducer key, it won't replace it If we force it by settings force to true, it won't replace it either.

Should not the force parameter set to true replace the reducer even if injectedReducers has it?

GuillaumeCisco avatar Aug 24 '17 15:08 GuillaumeCisco

I've just created a PR for fixing this issue: https://github.com/randallknutson/redux-injector/pull/10 It would be great if it could be merged quickly and released on npm.

It allows us to support hot reloading with reducer. I've also made the same change with redux-sagas-injector.

GuillaumeCisco avatar Aug 28 '17 12:08 GuillaumeCisco