szaranger / firebase-saga

A library for connecting redux-saga middleware to Firebase.
58 stars 15 forks source link

FETCH_POSTS not in actions in example #11

Open justinhandley opened 7 years ago

justinhandley commented 7 years ago

I'm trying to get your blog demo working, but fetch posts is never called. I noticed the FETCH_POSTS is not in the reducer and I'm wondering if that is the issue?

szaranger commented 7 years ago

FETCH_POSTS action is only handled by the sagas for firing the API call and not by the reducer, so can't be the reason. Please check if you have configured the Firebase environment configuration correctly.

justinhandley commented 7 years ago

I think it may be in the way I'm creating the store. I'm trying to integrate your project with react-boilerplate. My store is

`/**

import { createStore, applyMiddleware, compose } from 'redux'; import { fromJS } from 'immutable'; import { routerMiddleware } from 'react-router-redux'; import createSagaMiddleware from 'redux-saga'; import createReducer from './reducers'; import firebase from 'firebase' import config from './config' import rootSaga from './sagas';

firebase.initializeApp(config.firebase);

const sagaMiddleware = createSagaMiddleware();

export default function configureStore(initialState = {}, history) { // Create the store with two middlewares // 1. sagaMiddleware: Makes redux-sagas work // 2. routerMiddleware: Syncs the location/URL path to the state const middlewares = [ sagaMiddleware, routerMiddleware(history), ];

const enhancers = [ applyMiddleware(...middlewares), ];

// If Redux DevTools Extension is installed use it, otherwise use Redux compose / eslint-disable no-underscore-dangle / const composeEnhancers = process.env.NODE_ENV !== 'production' && typeof window === 'object' && window.REDUX_DEVTOOLS_EXTENSION_COMPOSE ? window.REDUX_DEVTOOLS_EXTENSION_COMPOSE : compose; / eslint-enable /

const store = createStore( createReducer(), fromJS(initialState), composeEnhancers(...enhancers) );

// Extensions store.runSaga = sagaMiddleware.run; store.runSaga(rootSaga) store.asyncReducers = {}; // Async reducer registry

// Make reducers hot reloadable, see http://mxs.is/googmo / istanbul ignore next / if (module.hot) { module.hot.accept('./reducers', () => { import('./reducers').then((reducerModule) => { const createReducers = reducerModule.default; const nextReducers = createReducers(store.asyncReducers);

    store.replaceReducer(nextReducers);
  });
});

}

return store; } `

Can you see an error there?