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

TypeError: Cannot read property ‘merge’ of undefined #4

Closed
pekq opened this issue Jun 6, 2018 · 4 comments · Fixed by #6
Closed

TypeError: Cannot read property ‘merge’ of undefined #4

pekq opened this issue Jun 6, 2018 · 4 comments · Fixed by #6

Comments

@pekq
Copy link

pekq commented Jun 6, 2018

At times the reconciler fails to merge and throws this error.
I was unable to pin point when exactly this happens or why.
Presumably after larger state structure change.

Uncaught (in promise) TypeError: Cannot read property ‘merge’ of undefined
   at reconciler.js:34
   at Array.forEach (<anonymous>)
   at s (reconciler.js:16)
   at persistReducer.js:91
   at n (reduxsauce.js:229)
   at l (createStore.js:165)
   at middleware.js:71
   at index.js:48
   at Object.dispatch (middleware.js:66)
   at Object.l [as rehydrate] (persistStore.js:87)
   at persistReducer.js:57
(anonymous) @ reconciler.js:34
s @ reconciler.js:16
(anonymous) @ persistReducer.js:91
n @ reduxsauce.js:229
l @ createStore.js:165
(anonymous) @ middleware.js:71
(anonymous) @ index.js:48
(anonymous) @ middleware.js:66
l @ persistStore.js:87
(anonymous) @ persistReducer.js:57
Promise.then (async)
(anonymous) @ persistReducer.js:56
Promise.then (async)
(anonymous) @ persistReducer.js:52
n @ reduxsauce.js:229
l @ createStore.js:165
(anonymous) @ middleware.js:71
(anonymous) @ index.js:48
(anonymous) @ middleware.js:66
s.persist @ persistStore.js:96
o @ persistStore.js:99
t.a @ CreateStore.js:37
t.a @ index.js:47
(anonymous) @ App.js:14
t @ bootstrap abaa5d98ccee410482ed:19
(anonymous) @ main.b4c585ff.js:71680
t @ bootstrap abaa5d98ccee410482ed:19
(anonymous) @ main.b4c585ff.js:65389
t @ bootstrap abaa5d98ccee410482ed:19
(anonymous) @ bootstrap abaa5d98ccee410482ed:62
(anonymous) @ bootstrap abaa5d98ccee410482ed:62
@hilkeheremans
Copy link
Owner

That would be tricky to track down without some kind of view on what the persisted state was. Judging by your issue, I assume you can't reliably reproduce this?

@pekq
Copy link
Author

pekq commented Jun 13, 2018

I managed to reproduce this consistently by removing one of the slice reducers.
Eg.

    export const reducers = persistCombineReducers(ReduxPersist.config, {
      router: routerReducer,
-     login: require('../Shared/Redux/LoginRedux').reducer
    })

@tasos14
Copy link
Contributor

tasos14 commented Jun 14, 2018

Hi @pekq @hilkeheremans,
i think that this error occurs because the reconciler tries to use merge at something that is not an object. We had the same problem at work.

hilkeheremans added a commit that referenced this issue Jun 19, 2018
Fix #4: Fails on some non-object data structures
@hilkeheremans
Copy link
Owner

Merged -- thanks for your contribution!

I have some docs to update, that will follow in the next few days.

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

Successfully merging a pull request may close this issue.

3 participants