noderaider / redux-idle-monitor

A Redux component to schedule events at stages of user idleness across multiple browser tabs.
https://noderaider.github.io/redux-idle-monitor/
MIT License
105 stars 9 forks source link

idle monitor state should have idle value #14

Closed damiangreen closed 7 years ago

damiangreen commented 7 years ago

I've set it up as described, with a few tweaks as i'm using https://github.com/davezuko/react-redux-starter-kit I get this error continuously: image

And i don't see 'idle' as a key in my state. The library seems to react to state changes however.

I also get No reducer provided for key "idle" at start

  const middleware = [thunk, idleMiddleware]`
....
const store = createStore(
    makeRootReducer(),
    initialState,
    composeEnhancers(
      applyMiddleware(...middleware),
      ...enhancers
    )
  )

reducers.js

import { combineReducers } from 'redux'
import locationReducer from './location'
import { reducer as idle } from 'redux-idle-monitor'

export const makeRootReducer = (asyncReducers) => {
  return combineReducers({
    location: locationReducer,
    idle: idle,
    ...asyncReducers
  })
}
damiangreen commented 7 years ago

doh. I figured it out, my Dux module was named the same as 'redux-idle-monitor' and I omitted the relative path './'

import { reducer as idle } from './redux-idle-monitor'

cchamberlain commented 7 years ago

@damiangreen happy to hear you got it figured out, please open another issue / PR if anything could have been more intuitive (better error messages, etc)!