mobx: TypeError: undefined is not a constructor (evaluating 'newItems.map(adm.makeChildReactive)')
I can’t figure out this error, but it seems like it may be a problem with mobx. But it might not.
The top of the stack trace has spliceWithArray and replace (from observablearray.ts), and then my code, which is calling collection.push(myobservableobject) where collection is an empty observable array.
One point of confusion is why is my code calling push but then the stack trace shows that I called to replace?
I will see if I can put together a minimal case to reproduce.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 25 (10 by maintainers)
We’re seeing similar flaky test results in PhantomJS 2.1.13, node 6.7.0, karma 1.3.0, mobx 2.5.1
Every so often an array marked as @observable isn’t actually registering as an ObservableArray. It also only happens when bundled with our full spec suite. Compiling and running the spec by itself doesn’t produce the error. The error also never occurs on Chrome or Electron. But we need something headless to run in CI. I guess I need to figure out how to use karma with xvfb. 😦
@mikedklein @mweststrate Here’s a boiled down version that i was able to reliably reproduce on my machine (mobx 2.4.2 and phantomjs 2.1.12 on windows)
https://gist.github.com/krtools/819293023786a240de144e2a970562e6
can’t figure out how to reproduce this reliably. However, I found a workaround: use chrome for my automated tests instead of PhantomJS. It seems to be something that only happens under PhantomJS.
Closing since I am unable to provide reproducible case.