Registry /
web-framework / redux-async-initial-state
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
outerReducer
✓ import { outerReducer } from 'redux-async-initial-state'
✗ import outerReducer from 'redux-async-initial-state'
Named export, not default. Must use destructured import.
innerReducer
✓ import { innerReducer } from 'redux-async-initial-state'
✗ import { innerReducer } from 'redux-async-initial-state/inners'
Named export, no subpath. Optional; only needed if tracking loading state.
middleware
✓ import { middleware } from 'redux-async-initial-state'
✗ const middleware = require('redux-async-initial-state').middleware
Named export, available as ESM or CJS. CJS require works but ESM is preferred.
LOADING
✓ import { LOADING } from 'redux-async-initial-state'
Action type constant, named export. Used internally; rarely needed by consumers.
Sets up Redux store with async initial state loading via HTTP fetch.
import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
import { outerReducer, innerReducer, middleware } from 'redux-async-initial-state';
const reducer = outerReducer(combineReducers({
// ... your reducers
asyncInitialState: innerReducer,
}));
const loadStore = () => {
return new Promise(resolve => {
fetch('/api/initial-state')
.then(response => response.json())
.then(resolve);
});
};
const store = createStore(
reducer,
compose(applyMiddleware(middleware(loadStore)))
);
Errors
Common errors & fixes
TypeError: middleware is not a function
Calling `middleware` as a function without argument or using it directly in applyMiddleware without invoking it first.
fixUse applyMiddleware(middleware(loadStore))
Uncaught Error: Expected the nextReducer to be a function
The outerReducer received something that is not a reducer (e.g., plain object or undefined).
fixEnsure outerReducer wraps a valid reducer, e.g., outerReducer(combineReducers({...})) Action 'REDUX_ASYNC_INITIAL_STATE' not recognized by reducer
Missing `outerReducer` wrapper, so the store's reducer does not handle the async state replacement action.
fixWrap your combined reducer with outerReducer.
Audit
Dependencies
No dependency data recorded yet.