elgerlambert / redux-localstorage

Store enhancer that syncs (a subset) of your Redux store state to localstorage.
MIT License
1.32k stars 107 forks source link

actions dispatched by redux-saga are not detected by redux-localstorage middleware. #39

Closed jhogendorn closed 8 years ago

jhogendorn commented 8 years ago

This is on the redux-localstorage@rc1 package

const rootMiddleware = compose(
  applyMiddleware(
    syncHistory(browserHistory),
    sagaMiddleware(...[sagas]),
    ...[otherMiddleware],
  )
)

  const finalReducer = compose(
    mergePersistedState()
  )(reducer)

  const storage = compose(
    filter(persistPaths)
  )(adapter(window.localStorage));

  const createPersistentStore = compose(
    persistState(storage, persistKey)
  )(createStore)

  return createPersistentStore(
    finalReducer,
    rootMiddleware,
  )

I'm finding that the localstorage middleware does not fire when actions are dispatched from a saga via put, however actions dispatched outside saga's hit the middleware just fine.

I'm not sure if this is a redux-saga issue, a redux-localstorage, or if I'm just doing something dumb, so apologies for the cross-issue.