-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need help, SSR not working with Redux Saga #34
Comments
Hey, my apologies for the long wait @Lokesh235 - I'm looking to ensure this is fixed with version 2.0. If you're interested, I could really use your thoughts for what you'd like to see in the upcoming version. Feel free to comment on the issue here with any suggestions. :) |
@Lokesh235 Changes I've made const composeEnhancers = window.REDUX_DEVTOOLS_EXTENSION_COMPOSE || compose; const store = createStore( sagaMiddleware.run(watchStatus); return { --------/sagas/index.js-------- import * as actionTypes from '../actionTypes'; import { testSaga } from './testSaga'; export function* watchStatus() { --------/testSaga.js-------- import * as actionTypes from "../actionTypes"; export function* testSaga(action) { --------actionTypes.js-------- |
👍 |
Hi,
I integrated redux-saga in place of thunk in the code base. Content from API is getting rendered on page but on view page source there is nothing but the static content and also state is empty. I am not able to get what am I missing here. Following are the code changes:
In store.js, replaced thunk with saga,
import createSagaMiddleware, {END} from 'redux-saga';
...
...
const sagaMiddleware = createSagaMiddleware();
const middleware = [routerMiddleware(history), sagaMiddleware];
...
...
// Create the store
const store = createStore(
connectRouter(history)(rootReducer),
Immutable(initialState),
composedEnhancers
);
sagaMiddleware.run(rootSaga);
store.runSaga = sagaMiddleware.run;
store.close = () => store.dispatch(END);
return {
store,
history
};
========================================================
In loader.js,
...
...
else {
// Otherwise, we carry on...
store.runSaga(rootSagas).done.then(() => {
// Let's give ourself a function to load all our page-specific JS assets for code splitting
const extractAssets = (assets, chunks) =>
Object.keys(assets)
.filter(asset => chunks.indexOf(asset.replace('.js', '')) > -1)
.map(k => assets[k]);
I would really appreciate if someone can help me out with this.
Thanks :)
The text was updated successfully, but these errors were encountered: