TypeError: Cannot read property 'confirm' of undefined
Closed this issue · 11 comments
version: 7.6.1
I think this might happened during registering into reducers or when added ReduxToastr element
Version 7.5.2 works
ReduxToastr.js:188 Uncaught TypeError: Cannot read property 'confirm' of undefined
at ReduxToastr.render (ReduxToastr.js:188)
at finishClassComponent (react-dom.development.js:14741)
at updateClassComponent (react-dom.development.js:14696)
at beginWork (react-dom.development.js:15644)
at performUnitOfWork (react-dom.development.js:19312)
at workLoop (react-dom.development.js:19352)
at HTMLUnknownElement.callCallback (react-dom.development.js:149)
at HTMLUnknownElement.sentryWrapped (helpers.js:74)
at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
at invokeGuardedCallback (react-dom.development.js:256)
at replayUnitOfWork (react-dom.development.js:18578)
at renderRoot (react-dom.development.js:19468)
at performWorkOnRoot (react-dom.development.js:20342)
at performWork (react-dom.development.js:20254)
at performSyncWork (react-dom.development.js:20228)
at requestWork (react-dom.development.js:20097)
at scheduleWork (react-dom.development.js:19911)
at scheduleRootUpdate (react-dom.development.js:20572)
at updateContainerAtExpirationTime (react-dom.development.js:20600)
at updateContainer (react-dom.development.js:20657)
at ReactRoot../node_modules/react-dom/cjs/react-dom.development.js.ReactRoot.render (react-dom.development.js:20953)
at react-dom.development.js:21090
at unbatchedUpdates (react-dom.development.js:20459)
at legacyRenderSubtreeIntoContainer (react-dom.development.js:21086)
at render (react-dom.development.js:21155)
at Module../src/index.tsx (index.tsx:15)
at webpack_require (bootstrap:63)
at Object.0 (store.ts:10)
at webpack_require (bootstrap:63)
@tonoslav I've changed the mapping to redux state on this version, have you change anything on that matter?
@diegoddox Ive changed nothing just after update to newest version I've got this error
I get the same error when I remove 'toastr' from my persisted redux store. I never want the toasts to show again after a user refreshes the screen, so I stopped persisting 'toastr'. When I do that I will occasionally get the above error. Once it happens it is stuck, my app will not load until clearing my persisted redux store.
if it helps track it down: I am using redux-offline and redux-persist v5. in my redux-persist config I am blacklisting 'toastr' in order to avoid persisting it.
In 7.4.4 I had a different error when I blacklisted 'toastr'.
in 7.6.1 I get the same error as above: Cannot read property 'confirm'
The issue does not happen immediately. I am not sure how to make the error happen consistently. It must be some sort of race condition while my app is launching.
I have none of this so this should be the case I think
I have updated from 7.5.1 to 7.6.1 and it crashed with error Cannot read property 'confirm'. I haven't changed any Redux mappings on my end, just updated the react-redux-toastr version.
Thanks everyone, I'm just a bit busy those coming day, not sure when I will be able to work on it.
Are any of you guys using immutablejs?
Yes, I am using immutablejs.
For those of who are using immutablejs
you will have to pass the getState
props
like:
<ReduxToastr
{...anotherProps}
getState={(state) => state.get('toastr')}
/>
@diegoddox Thanks! This fixed the issue for me as well.
I ended up with: getState={() => this.props.toastr || initialState.toastr}