Upgrading from v4.0.1 to 5.0.0 causes some issues related to computed props
See original GitHub issueUpgrading to the newest release of easy-peasy has broken some of our tests:
Test Suites: 31 failed, 34 passed, 65 total
Tests: 145 failed, 246 passed, 391 total
Upon further inspection, it seems that there is some issues with some computed properties being undefined (when they are not supposted to be).
Here is an excerpt of one of the repeating errors:
TypeError: Cannot read property 'map' of undefined
at actionReducer (src/components/App/Local.model.ts:109:52)
at fn (../../../node_modules/easy-peasy/src/create-reducer.js:8:43)
at simpleProduce (../../../node_modules/easy-peasy/src/lib.js:124:20)
at runActionReducerAtPath (../../../node_modules/easy-peasy/src/create-reducer.js:8:5) at reducerForActions (../../../node_modules/easy-peasy/src/create-reducer.js:13:14)
at rootReducer (../../../node_modules/easy-peasy/src/create-reducer.js:37:31)
at next (../../../node_modules/redux/lib/redux.js:219:22)
at next (../../../node_modules/easy-peasy/src/persistence.js:236:19)
at next (../../../node_modules/easy-peasy/src/effects.js:6:14)
at ../../../node_modules/easy-peasy/src/listeners.js:5:20
at next (../../../node_modules/redux-thunk/lib/index.js:14:16)
at Object.dispatch (../../../node_modules/easy-peasy/src/computed-properties.js:29:12) at Object.setGeneration (../../../node_modules/easy-peasy/src/actions.js:12:15
Has anything changed in how computed properties work, from v4 to v5?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:24 (12 by maintainers)
Top Results From Across the Web
Mutliple warnings and deprecated dependencies on npm ...
I had a similar issue. I used the following commands to firstly update the version of npm I was using, uninstalling older versions...
Read more >Troubleshooting NuGet Package Restore in Visual Studio
When using packages. config, the error means that the package is not installed in the packages folder at the solution root.
Read more >material-ui/core/CHANGELOG.md - UNPKG
This is a reminder that all ongoing work has moved to v5. This means a feature freeze on v4. The development of v4...
Read more >asp.net mvc - NuGet Package restore failed for project ...
I tried deleting the packages folder, opening up up Visual Studios again and then rebuilding. That didn't resolve it. I tried manually installing...
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

Across our mono repo, we have a total of 884 unit tests - most of them touches
easy-peasyin some shape or form. I’ve run the test for the entire repo, and only a single test is failing.I’ve been scratching my head for a while, to figure out why the single test is failing. I have tried reproducing the exact conditions in the sandbox, but the tests are still passing there.
I just tried debugging the failing test - and of course, we got a schrödingers situation here. When I debug - the tests are of course passing 👯♂️
I’ve tried to insert a delay between the action and
getState- but that had no effect on the result.If you got any pointers on what I could try next, I’m all ears!
Edit:
I went poking, and came across this in the latest commit:
The failing test does this:
getState()then verify changes from step 2The action in step 2 uses computed props internally, so I figured based on the comments above that I should try to call
getState()(targeting the computed prop) in between step 1 and 2.Et voila, it is now passing 🎉🎉🎉
The wierd thing is, that the contrived test example in the sandbox has the same setup - but it is passing without issues. 🤔
Maybe this is enough info to solve the last kink, but if not, let me know & I’ll help out where I can 👍
We got some progress 👏
Just a single test to go 😁
I’ve reconstructed the model & related test in the sandbox, and it generates the same error when using
easy-peasy@5.0.2- but it passes witheasy-peasy@5.0.3🤔 However, I still get the error locally.The only difference in functionality between the sandbox model and the local (failing) modal, is that the local modal has some dependencies of a computed prop from another store.
I’ll tinker a little more with it, and see if I manage to reproduce the issue in the sandbox.