Skip to content
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

Support Immutable.js #27

Open
xnyl opened this issue Apr 20, 2018 · 2 comments
Open

Support Immutable.js #27

xnyl opened this issue Apr 20, 2018 · 2 comments

Comments

@xnyl
Copy link

xnyl commented Apr 20, 2018

I am using the lib wit redux-immutable store. My state is Immutable.Map(). That causes problem with action.js selectIdleState() function, since the lib is retrieving idle state with state.idle instead of state.get('idle'). That causes error in the console like 'Uncaught Error: idle monitor state should have idle value'. Basides above, the lib works great, I really appreciate your work.

My proposition is to add something like stateTransformer function, configurable with opts. If present, the user will have an option to define how his state is going to be transformed into expected pure JS Object. Like this:
const opts = { ... idleStatusAction, activeEvents, stateTransformer: state => state.toJS() // assuming its Immutable.js }

What do you think? Maybe there is an other way to achieve this?

@cchamberlain
Copy link
Member

Thanks for opening. I'm definitely open to this, would like it to support Immutable.js. I think the proposal sounds good but its a tad tricky to implement. Would either need to replace the following call, maybe others or integrate it into the redux-mux helper:

https://github.com/noderaider/redux-idle-monitor/blob/master/src/lib/middleware.js#L42

I published redux-mux so happy with either path, just not implementing this at its level would require more changes in this library. Feel free to post a PR, otherwise I will take a look at this the next time I get a chance to work on the project.

@hatemalimam
Copy link

as a temporary fix, I have created a fork which works ONLY with immutable.js, might be helpful for someone searching for a solution

https://github.com/hatemalimam/redux-idle-monitor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants