Merge() from lodash causes warnings in Immutable.js #8

Closed
opened 2015-09-20 08:54:22 +00:00 by romanenko · 13 comments
romanenko commented 2015-09-20 08:54:22 +00:00 (Migrated from github.com)

I'm using Immutable decorator to load state data with localStorage engine. But on initial load I get a bunch of warnings from Immutable library:

iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error
    at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21)
    at pathKey (webpack:///./~/lodash/index.js?:2452:51)
    at isArrayLike (webpack:///./~/lodash/index.js?:4075:40)
    at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:13)
    at eval (webpack:///./~/lodash/index.js?:2366:11)
    at arrayEach (webpack:///./~/lodash/index.js?:1289:13)
    at baseMerge (webpack:///./~/lodash/index.js?:2358:7)
    at eval (webpack:///./~/lodash/index.js?:3024:13)
    at eval (webpack:///./~/lodash/index.js?:8152:31)
    at exports.default (webpack:///./~/redux-storage/lib/reducer.js?:13:76)
immutable.js:4637 iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error
    at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21)
    at isTypedArray (webpack:///./~/lodash/index.js?:8998:51)
    at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:60)
    at eval (webpack:///./~/lodash/index.js?:2366:11)
    at arrayEach (webpack:///./~/lodash/index.js?:1289:13)
    at baseMerge (webpack:///./~/lodash/index.js?:2358:7)
    at eval (webpack:///./~/lodash/index.js?:3024:13)
    at eval (webpack:///./~/lodash/index.js?:8152:31)
    at exports.default (webpack:///./~/redux-storage/lib/reducer.js?:13:76)
    at dispatch (webpack:///./~/redux/lib/createStore.js?:120:22)
immutable.js:4637 iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error
    at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21)
    at pathKey (webpack:///./~/lodash/index.js?:2452:51)
    at isArrayLike (webpack:///./~/lodash/index.js?:4075:40)
    at isArguments (webpack:///./~/lodash/index.js?:8469:37)
    at isPlainObject (webpack:///./~/lodash/index.js?:8924:77)
    at baseMergeDeep (webpack:///./~/lodash/index.js?:2421:18)
    at eval (webpack:///./~/lodash/index.js?:2366:11)
    at arrayEach (webpack:///./~/lodash/index.js?:1289:13)
    at baseMerge (webpack:///./~/lodash/index.js?:2358:7)

I guess, this is happening, because merge() function on lodash is used https://github.com/michaelcontento/redux-storage/blob/master/src/reducer.js#L8 when LOAD action being handled and it uses .length somehow.

What we can do with it?

I'm using Immutable decorator to load state data with localStorage engine. But on initial load I get a bunch of warnings from Immutable library: ``` iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21) at pathKey (webpack:///./~/lodash/index.js?:2452:51) at isArrayLike (webpack:///./~/lodash/index.js?:4075:40) at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:13) at eval (webpack:///./~/lodash/index.js?:2366:11) at arrayEach (webpack:///./~/lodash/index.js?:1289:13) at baseMerge (webpack:///./~/lodash/index.js?:2358:7) at eval (webpack:///./~/lodash/index.js?:3024:13) at eval (webpack:///./~/lodash/index.js?:8152:31) at exports.default (webpack:///./~/redux-storage/lib/reducer.js?:13:76) immutable.js:4637 iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21) at isTypedArray (webpack:///./~/lodash/index.js?:8998:51) at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:60) at eval (webpack:///./~/lodash/index.js?:2366:11) at arrayEach (webpack:///./~/lodash/index.js?:1289:13) at baseMerge (webpack:///./~/lodash/index.js?:2358:7) at eval (webpack:///./~/lodash/index.js?:3024:13) at eval (webpack:///./~/lodash/index.js?:8152:31) at exports.default (webpack:///./~/redux-storage/lib/reducer.js?:13:76) at dispatch (webpack:///./~/redux/lib/createStore.js?:120:22) immutable.js:4637 iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21) at pathKey (webpack:///./~/lodash/index.js?:2452:51) at isArrayLike (webpack:///./~/lodash/index.js?:4075:40) at isArguments (webpack:///./~/lodash/index.js?:8469:37) at isPlainObject (webpack:///./~/lodash/index.js?:8924:77) at baseMergeDeep (webpack:///./~/lodash/index.js?:2421:18) at eval (webpack:///./~/lodash/index.js?:2366:11) at arrayEach (webpack:///./~/lodash/index.js?:1289:13) at baseMerge (webpack:///./~/lodash/index.js?:2358:7) ``` I guess, this is happening, because `merge()` function on `lodash` is used https://github.com/michaelcontento/redux-storage/blob/master/src/reducer.js#L8 when `LOAD` action being handled and it uses `.length` somehow. What we can do with it?
romanenko commented 2015-09-21 05:13:20 +00:00 (Migrated from github.com)

Looks like the issue is still present. Now there are the same warnings but in the context of myMerge() and mergeDeep():

iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error
    at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21)
    at pathKey (webpack:///./~/lodash/index.js?:2452:51)
    at isArrayLike (webpack:///./~/lodash/index.js?:4075:40)
    at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:13)
    at eval (webpack:///./~/lodash/index.js?:2366:11)
    at arrayEach (webpack:///./~/lodash/index.js?:1289:13)
    at baseMerge (webpack:///./~/lodash/index.js?:2358:7)
    at eval (webpack:///./~/lodash/index.js?:3024:13)
    at eval (webpack:///./~/lodash/index.js?:8152:31)
    at myMerge (webpack:///./~/redux-storage/lib/reducer.js?:15:30)
immutable.js:4637 iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error
    at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21)
    at isTypedArray (webpack:///./~/lodash/index.js?:8998:51)
    at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:60)
    at eval (webpack:///./~/lodash/index.js?:2366:11)
    at arrayEach (webpack:///./~/lodash/index.js?:1289:13)
    at baseMerge (webpack:///./~/lodash/index.js?:2358:7)
    at eval (webpack:///./~/lodash/index.js?:3024:13)
    at eval (webpack:///./~/lodash/index.js?:8152:31)
    at myMerge (webpack:///./~/redux-storage/lib/reducer.js?:15:30)
    at exports.default (webpack:///./~/redux-storage/lib/reducer.js?:20:58)

2015-09-21 11-10-42 developer tools - http- localhost-3000

Looks like the issue is still present. Now there are the same warnings but in the context of `myMerge()` and `mergeDeep()`: ``` iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21) at pathKey (webpack:///./~/lodash/index.js?:2452:51) at isArrayLike (webpack:///./~/lodash/index.js?:4075:40) at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:13) at eval (webpack:///./~/lodash/index.js?:2366:11) at arrayEach (webpack:///./~/lodash/index.js?:1289:13) at baseMerge (webpack:///./~/lodash/index.js?:2358:7) at eval (webpack:///./~/lodash/index.js?:3024:13) at eval (webpack:///./~/lodash/index.js?:8152:31) at myMerge (webpack:///./~/redux-storage/lib/reducer.js?:15:30) immutable.js:4637 iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error at src_Map__Map.Object.defineProperty.get (webpack:///./~/immutable/dist/immutable.js?:4632:21) at isTypedArray (webpack:///./~/lodash/index.js?:8998:51) at baseMergeDeep (webpack:///./~/lodash/index.js?:2416:60) at eval (webpack:///./~/lodash/index.js?:2366:11) at arrayEach (webpack:///./~/lodash/index.js?:1289:13) at baseMerge (webpack:///./~/lodash/index.js?:2358:7) at eval (webpack:///./~/lodash/index.js?:3024:13) at eval (webpack:///./~/lodash/index.js?:8152:31) at myMerge (webpack:///./~/redux-storage/lib/reducer.js?:15:30) at exports.default (webpack:///./~/redux-storage/lib/reducer.js?:20:58) ``` ![2015-09-21 11-10-42 developer tools - http- localhost-3000](https://cloud.githubusercontent.com/assets/336141/9985665/f083a584-6051-11e5-9dc6-9acf50189638.png)
michaelcontento commented 2015-09-21 05:20:16 +00:00 (Migrated from github.com)

Thank you for reporting this! With the latest change all warnings should be gone :)

Thank you for reporting this! With the latest change all warnings should be gone :)
romanenko commented 2015-09-21 06:45:28 +00:00 (Migrated from github.com)

Just installed v1.2.3 and I still get the same warnings 😞

Just installed `v1.2.3` and I still get the same warnings :disappointed:
michaelcontento commented 2015-09-21 08:28:02 +00:00 (Migrated from github.com)

Strange .. could you provide me with the values of oldState and newState of the myMerge function in lib/recuder.js?

Strange .. could you provide me with the values of `oldState` and `newState` of the `myMerge` function in `lib/recuder.js`?
romanenko commented 2015-09-21 09:07:57 +00:00 (Migrated from github.com)

I use redux-logger middleware in my redux-app and when REDUX_STORAGE_LOAD action is dispatched I see that oldState and newState are ImmutableJS instances. Two states are successfully merged.

2015-09-21 15-04-42 developer tools - http- localhost-3000

I use `redux-logger` middleware in my redux-app and when REDUX_STORAGE_LOAD action is dispatched I see that `oldState` and `newState` are ImmutableJS instances. Two states are successfully merged. ![2015-09-21 15-04-42 developer tools - http- localhost-3000](https://cloud.githubusercontent.com/assets/336141/9988427/52bbb424-6072-11e5-97d7-1fa3d4c859e3.png)
michaelcontento commented 2015-09-21 09:24:00 +00:00 (Migrated from github.com)

Is it possible for you to create a boiled down example that triggers the warning? Preferable by calling the reducer function directly? Here is how it's done in the testsuite: src/__tests__/reducer-test.js

The problem for me is, that I honestly don't have any clue at all :( It's currently impossible for me to find a broken combination that triggers those warnings in immutable.

Is it possible for you to create a boiled down example that triggers the warning? Preferable by calling the reducer function directly? Here is how it's done in the testsuite: [`src/__tests__/reducer-test.js`](https://github.com/michaelcontento/redux-storage/blob/master/src/__tests__/reducer-test.js#L37-L45) The problem for me is, that I honestly don't have any clue at all :( It's currently impossible for me to find a broken combination that triggers those warnings in immutable.
romanenko commented 2015-09-22 11:21:41 +00:00 (Migrated from github.com)

Ok, I, surely, will do it during the week.

Ok, I, surely, will do it during the week.
michaelcontento commented 2015-10-07 18:25:32 +00:00 (Migrated from github.com)

@romanenko, any news on this? I'm about to release a new version to npm soon and I'd like to get this one closed too :)

@romanenko, any news on this? I'm about to release a new version to npm soon and I'd like to get this one closed too :)
romanenko commented 2015-10-07 21:31:11 +00:00 (Migrated from github.com)

@michaelcontento I'm sorry for the delay — i'm meeting deadlines in my client work projects. I'm using this great library in one of the client projects and I'm still getting this warnings in the console. I started to implement, but couldn't find time to finish, my boiled down example. Wouldn't you mind, I will finish it during this friday?

@michaelcontento I'm sorry for the delay — i'm meeting deadlines in my client work projects. I'm using this great library in one of the client projects and I'm still getting this warnings in the console. I started to implement, but couldn't find time to finish, my boiled down example. Wouldn't you mind, I will finish it during this friday?
michaelcontento commented 2015-10-08 12:51:56 +00:00 (Migrated from github.com)

Ok, no problem and thank you for this feedback.

Ok, no problem and thank you for this feedback.
slightlytyler commented 2015-10-11 23:33:54 +00:00 (Migrated from github.com)

Running into similar problems but with the async storage. @romanenko did you get a chance to work on an example? I might be able to whip something up

Running into similar problems but with the async storage. @romanenko did you get a chance to work on an example? I might be able to whip something up
Agowan commented 2015-10-13 09:43:31 +00:00 (Migrated from github.com)

I have just implemented redux-storage in a new project, and got these warnings as I'm using immutable.
Took the time to reproduce the problem https://github.com/Agowan/react-storage-immutable-warnings.

I have just implemented redux-storage in a new project, and got these warnings as I'm using immutable. Took the time to reproduce the problem https://github.com/Agowan/react-storage-immutable-warnings.
michaelcontento commented 2015-10-17 12:13:50 +00:00 (Migrated from github.com)

Thank you @Agowan for the example! With this I managed to publish a fixed version (1.3.1) to npm 🚀

Thank you @Agowan for the example! With this I managed to publish a fixed version (1.3.1) to npm :rocket:
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MichaelContento/redux-storage#8
No description provided.