A library for dynamically injecting Redux sagas at runtime, enabling code splitting and lazy loading of sagas. Version 1.1.5 supports redux-saga 1.x and provides helpers for HMR and SSR. Unlike manual store manipulation, it uses a central key-based tracking mechanism and works alongside redux-reducers-injector. It has a small API surface (createInjectSagasStore, injectSaga, injectSagaBulk, reloadSaga) and is popular in universal/isomorphic React apps. Release cadence is irregular; current version fixes security issues in dependencies. Key differentiators: built-in HMR support, context store usage, and compatibility with react-universal-component.
npm install redux-sagas-injectorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a store with injected sagas, injecting a saga later, and hot reloading. Uses TypeScript-style imports but works in JavaScript.
Upgrade redux-saga to 1.x and ensure all sagas are generator functions. Remove any legacy buffer or channel usage.
Upgrade to v1.0.0 or later to avoid transform-runtime conflicts.
Use reloadSaga to replace an existing saga, or call injectSaga only once per key (e.g., in component lifecycle). If using React component, ensure injectSaga is called only on mount.
Only use one store per application, or create your own sagaMiddleware using createSagaMiddleware from redux-saga if you need multiple stores.
Evaluate migrating to Redux Toolkit's configureStore and dynamic middleware/reducer injection patterns.
Use createInjectSagasStore (not createStore) and ensure sagaMiddleware is in the applyMiddleware chain. Example:
const store = createInjectSagasStore({}, rootReducer, initialState, compose(applyMiddleware(sagaMiddleware)));Do not call sagaMiddleware.run(). The library handles running sagas internally via injectSaga. If you need to run a root saga manually, use createInjectSagasStore with initial sagas object.
Import as:
import { sagaMiddleware } from 'redux-sagas-injector';Use named import:
import { injectSaga } from 'redux-sagas-injector';