next-redux-saga
Advanced tools
Comparing version 4.0.3 to 4.1.0
{ | ||
"name": "next-redux-saga", | ||
"version": "4.0.3", | ||
"version": "4.1.0", | ||
"description": "redux-saga HOC for Next.js", | ||
@@ -32,2 +32,7 @@ "repository": "https://github.com/bmealhouse/next-redux-saga.git", | ||
"<rootDir>/jest.setup.js" | ||
], | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
"package.json", | ||
"yarn.lock" | ||
] | ||
@@ -103,2 +108,3 @@ }, | ||
"jest": "24.1.0", | ||
"jest-express": "1.10.1", | ||
"lint-staged": "8.1.3", | ||
@@ -105,0 +111,0 @@ "next": "7.0.2", |
@@ -40,7 +40,6 @@ # next-redux-saga | ||
import createSagaMiddleware from 'redux-saga' | ||
import {sagaStarted} from './actions' | ||
import rootReducer from './root-reducer' | ||
import rootSaga from './root-saga' | ||
function configureStore(preloadedState) { | ||
function configureStore(preloadedState, {isServer, req = null}) { | ||
@@ -65,8 +64,10 @@ /** | ||
/** | ||
* next-redux-saga depends on `sagaTask` being attached to the store. | ||
* next-redux-saga depends on `sagaTask` being attached to the store during `getInitialProps`. | ||
* It is used to await the rootSaga task before sending results to the client. | ||
* However it should run only once - which must be regarded when using `next-redux-wrapper:^2.1.0` | ||
* However, next-redux-wrapper creates two server-side stores per request: | ||
* One before `getInitialProps` and one before SSR (see issue #62 for details). | ||
* On the server side, we run rootSaga during `getInitialProps` only: | ||
*/ | ||
if (!store.getState().saga.ran) { | ||
store.dispatch(sagaStarted()) | ||
if (req || !isServer) { | ||
store.sagaTask = sagaMiddleware.run(rootSaga) | ||
@@ -73,0 +74,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27571
154
29