You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: pass type check for Record in Immutable v4
* fix: extracting keys from Record in Immutable v4
* refactor: change warning to better reflect Immutable v4 types
* docs: better reflect both Immutable v3 and v4 types
* docs: replace Immutable.Iterable with Immutable.Collection
BREAKING CHANGE:
* build: change dependency type for immutable and extend version supported
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@
6
6
7
7
`redux-immutable` is used to create an equivalent function of Redux [`combineReducers`](http://redux.js.org/docs/api/combineReducers.html) that works with [Immutable.js](https://facebook.github.io/immutable-js/) state.
8
8
9
-
When Redux [`createStore`](https://github.com/reactjs/redux/blob/master/docs/api/createStore.md)`reducer` is created using `redux-immutable` then `initialState` must be an instance of [`Immutable.Iterable`](https://facebook.github.io/immutable-js/docs/#/Iterable).
9
+
When Redux [`createStore`](https://github.com/reactjs/redux/blob/master/docs/api/createStore.md)`reducer` is created using `redux-immutable` then `initialState` must be an instance of [`Immutable.Collection`](https://facebook.github.io/immutable-js/docs/#/Collection).
10
10
11
11
## Problem
12
12
13
-
When [`createStore`](https://github.com/reactjs/redux/blob/v3.0.6/docs/api/createStore.md) is invoked with `initialState` that is an instance of `Immutable.Iterable` further invocation of reducer will [produce an error](https://github.com/reactjs/redux/blob/v3.0.6/src/combineReducers.js#L31-L38):
13
+
When [`createStore`](https://github.com/reactjs/redux/blob/v3.0.6/docs/api/createStore.md) is invoked with `initialState` that is an instance of `Immutable.Collection` further invocation of reducer will [produce an error](https://github.com/reactjs/redux/blob/v3.0.6/src/combineReducers.js#L31-L38):
14
14
15
15
> The initialState argument passed to createStore has unexpected type of "Object".
16
16
> Expected argument to be an object with the following keys: "data"
@@ -21,7 +21,7 @@ This is because Redux `combineReducers` [treats `state` object as a plain JavaSc
21
21
22
22
## Usage
23
23
24
-
Create a store with `initialState` set to an instance of [`Immutable.Iterable`](https://facebook.github.io/immutable-js/docs/#/Iterable):
24
+
Create a store with `initialState` set to an instance of [`Immutable.Collection`](https://facebook.github.io/immutable-js/docs/#/Collection):
// state now must always have 'foo' property with its default value returned from fooReducer(undefined, action)
59
59
```
60
60
61
-
In general, `getDefaultState` function must return an instance of `Immutable.Iterable`that implements `get`, `set` and `withMutations` methods. Such iterables are `List`, `Map`, `OrderedMap`and `Record`.
61
+
In general, `getDefaultState` function must return an instance of `Immutable.Record` or `Immutable.Collection`that implements `get`, `set` and `withMutations` methods. Such collections are `List`, `Map`and `OrderedMap`.
return'The '+stateName+' is of unexpected type. Expected argument to be an instance of Immutable.Iterable with the following properties: "'+reducerNames.join('", "')+'".';
return'The '+stateName+' is of unexpected type. Expected argument to be an instance of Immutable.Collection or Immutable.Record with the following properties: "'+reducerNames.join('", "')+'".';
Copy file name to clipboardExpand all lines: tests/utilities/getUnexpectedInvocationParameterMessage.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -29,11 +29,11 @@ describe('utilities', () => {
29
29
expect(expectedErrorMessage).to.equal('Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.');
30
30
});
31
31
});
32
-
context('state is not an instance of Immutable.Iterable',()=>{
32
+
context('state is not an instance of Immutable.Collection or Immutable.Record',()=>{
expect(expectedErrorMessage).to.equal('The initialState argument passed to createStore is of unexpected type. Expected argument to be an instance of Immutable.Iterable with the following properties: "foo".');
36
+
expect(expectedErrorMessage).to.equal('The initialState argument passed to createStore is of unexpected type. Expected argument to be an instance of Immutable.Collection or Immutable.Record with the following properties: "foo".');
37
37
});
38
38
});
39
39
context('state defines properties that are not present in the reducer map',()=>{
0 commit comments