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

reducer must return immutable, how to handle js immutable types? #20

Open
elaijuh opened this issue Nov 12, 2015 · 2 comments
Open

reducer must return immutable, how to handle js immutable types? #20

elaijuh opened this issue Nov 12, 2015 · 2 comments

Comments

@elaijuh
Copy link

elaijuh commented Nov 12, 2015

say i have a state like this:

{ isFetching: true, data: {foo: 'foo', bar: 'bar'}}

so how to handle in isFetching reducer?

@mehiel
Copy link

mehiel commented Jan 26, 2016

I think I have a similar case with redux-thunk.
Can thunk work with redux-immutablejs? Even if I set enforceImmutable to false it seems to ignore the thunk middleware and just set the returned function as the new state.

@tonyxiao
Copy link

tonyxiao commented Mar 9, 2016

@elaijuh you can pass in false to the enforceImmutable key. Alternatively you can use this snippet


export const createReducer = (initialState, handlers, constructor) => {
  const enforceImmutable = Immutable.Iterable.isIterable(initialState)
  return _createReducer(initialState, handlers, enforceImmutable, constructor)
}

@indexiatech would be great if you could review.

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

No branches or pull requests

3 participants