MobX 4.9.1 Cannot redefine property: snapshot
See original GitHub issueI have a:
- Question
- Documentation improvement
- Issue:
- Provide error messages including stacktrace
Uncaught TypeError: Cannot redefine property: snapshot
at Function.defineProperty (<anonymous>)
at addReadOnlyProp (VM6409 mobx-state-tree.js:2758)
at ObjectNode$$1.finalizeDeath (VM6409 mobx-state-tree.js:1416)
at ObjectNode$$1.die (VM6409 mobx-state-tree.js:1393)
at executeAction$$1 (VM6410 mobx.js:658)
at ObjectNode$$1.res (VM6410 mobx.js:649)
at reconcileArrayChildren (VM6409 mobx-state-tree.js:3554)
at ArrayType$$1.willChange (VM6409 mobx-state-tree.js:3410)
at interceptChange$$1 (VM6410 mobx.js:2809)
at ObservableArrayAdministration.spliceWithArray (VM6410 mobx.js:2991)
at ObservableArray$$1.replace (VM6410 mobx.js:3109)
at ArrayType$$1.applySnapshot (VM6409 mobx-state-tree.js:3481)
at executeAction$$1 (VM6410 mobx.js:658)
at ArrayType$$1.res (VM6410 mobx.js:649)
at eval (VM6409 mobx-state-tree.js:1383)
at executeAction$$1 (VM6410 mobx.js:658)
at res (VM6410 mobx.js:649)
at runMiddleWares (VM6409 mobx-state-tree.js:2095)
at runWithActionContext$$1 (VM6409 mobx-state-tree.js:1992)
at ObjectNode$$1.res [as applySnapshot] (VM6409 mobx-state-tree.js:2015)
at ArrayType$$1.ComplexType$$1.reconcile (VM6409 mobx-state-tree.js:1604)
at OptionalValue$$1.reconcile (VM6409 mobx-state-tree.js:4662)
at Array.ModelType$$1.willChange (VM6409 mobx-state-tree.js:3928)
at interceptChange$$1 (VM6410 mobx.js:2809)
at ObservableObjectAdministration$$1.write (VM6410 mobx.js:3958)
at Object.set [as modelBArray] (VM6410 mobx.js:4132)
at Object.populate2 (VM9727 index.js:28)
at executeAction$$1 (VM6410 mobx.js:658)
at res (VM6410 mobx.js:649)
at runMiddleWares (VM6409 mobx-state-tree.js:2095)
at runWithActionContext$$1 (VM6409 mobx-state-tree.js:1992)
at res (VM6409 mobx-state-tree.js:2015)
at Object.ReactErrorUtils.invokeGuardedCallback (VM6242 ReactErrorUtils.js:69)
at executeDispatch (VM6241 EventPluginUtils.js:85)
at Object.executeDispatchesInOrder (VM6241 EventPluginUtils.js:108)
at executeDispatchesAndRelease (VM6239 EventPluginHub.js:43)
at executeDispatchesAndReleaseTopLevel (VM6239 EventPluginHub.js:54)
at Array.forEach (<anonymous>)
at forEachAccumulated (VM6246 forEachAccumulated.js:24)
at Object.processEventQueue (VM6239 EventPluginHub.js:257)
at runEventQueueInBatch (VM6309 ReactEventEmitterMixin.js:17)
at Object.handleTopLevel [as _handleTopLevel] (VM6309 ReactEventEmitterMixin.js:28)
at handleTopLevelImpl (VM6370 ReactEventListener.js:72)
at ReactDefaultBatchingStrategyTransaction.perform (VM6271 Transaction.js:140)
at Object.batchedUpdates (VM6369 ReactDefaultBatchingStrategy.js:62)
at Object.batchedUpdates (VM6256 ReactUpdates.js:97)
at dispatchEvent (VM6370 ReactEventListener.js:147)
- Provide a minimal sample reproduction.
https://codesandbox.io/s/my14ymkvnx
Please first click on the first button then click on the second button then have a look at the console.
- Did you check this issue wasn’t filed before?
- Elaborate on your issue. What behavior did you expect?
The store should update correctly, instead the error state above is thrown.
- State the versions of MobX and relevant libraries. Which browser / node / … version?
This happens in 4.9.1 It neither happens in 4.8 nor in 5.8 (Unfortunately we had to downgrade to 4.x due to IE11 and SEO issues)
We are also using: mobx-react: 5.4.2 mobx-state-tree: 3.8.1
- Idea:
- What problem would it solve for you?
Make it work without the error, as in previous versions
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
mobX: TypeError: Cannot read properties of undefined
I just playground with some code with mobX, ...
Read more >mobx-react @ 5.1.2 .. 5.4.4 - Package Diff
Visual diff of the npm package 'mobx-react' comparing 5.1.2 with 5.4.4. ... +* Fixed `Cannot read property 'forEach' of undefined` exception if ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Related to https://github.com/mobxjs/mobx-state-tree/issues/1143 and fixed by https://github.com/mobxjs/mobx-state-tree/pull/1144 which is in mobx-state-tree 3.10.1. Your example works if you update mobx-state-tree version. I think it can be closed.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.