Use redux-saga for async actions instead of default redux-thunk.
supnate / rekit-plugin-redux-saga Goto Github PK
View Code? Open in Web Editor NEWRekit plugin for redux-saga.
License: MIT License
Rekit plugin for redux-saga.
License: MIT License
Description
Our CI build was running out of memory and crashing as the number of actions and Jest tests increased. Narrowed the issue down to our Redux action tests, and eventually found out that nock was the culprit. The same issue and the fix are described here: nock/nock#1448
Essentially, on import nock is modifying the global https object to intercept outgoing API calls, and that change needs to be restored with nock.restore()
. The call to nock.cleanAll()
just clears any mock calls that have been set up.
To Repro
In any project with multiple action tests, run the test suite with memory usage logging turned on like so:
node --expose-gc <your_test_runner.js> --env=jsdom --no-watch --runInBand --logHeapUsage
Expected
Memory usage should be more or less flat, with the heap size rising and falling as GC takes place
Actual
Specific experiences may vary depending on the tests being run, and total memory available, but in our case there is a linear increase in RAM usage growing by roughly 15-30MB per test until the test run completes, or a Node exception is thrown when memory runs out.
Note that this may be an issue that test runners other than Jest can compensate for or handle differently. We have an older Rekit project that was using Mocha, and this issue never came up.
Hey @supnate thanks for all your work with rekit! I installed this plugin using yarn, yarn add rekit-plugin-redux-saga
and ran into a couple of errors. After yarn added the package, using the rekit cli command that is on the rekit docs rekit install-plugin rekit-plugin-redux-saga
fails due to cmd syntax error. It seems that the proper command is rekit install rekit-plugin-redux-saga
, which seemed to work fine. However, when I was using Portal to create a new Feature, I got an error in the UI stating TypeError: cannot read property 'hooks' of null, in a small 'Operation Failed' modal. Additionally, I received this error message and stack trace in the console:
Warning: Failed to load plugin: redux-saga, TypeError: Cannot read property 'app' of undefined.
TypeError: Cannot read property 'app' of undefined
at module.exports (C:\Users\me\anya\node_modules\rekit-plugin-redux-saga\action.js:16:24)
at config.accept.forEach (C:\Users\me\anya\node_modules\rekit-core\core\plugin.js:88:71)
at Array.forEach (native)
at plugins.map (C:\Users\me\anya\node_modules\rekit-core\core\plugin.js:85:23)
at Array.map (native)
at loadPlugins (C:\Users\me\anya\node_modules\rekit-core\core\plugin.js:75:21)
at getPlugins (C:\Users\me\anya\node_modules\rekit-core\core\plugin.js:15:5)
at Object.getCommand (C:\Users\me\anya\node_modules\rekit-core\core\plugin.js:119:17)
at Object.handleCommand (C:\Users\me\anya\node_modules\rekit-core\core\index.js:364:20)
at execCmd (C:\Users\me\anya\node_modules\rekit-portal\middleware\index.js:63:17)
I'm fairly certain that I've followed the documentation to the letter, though I think the plugin installation could be improved upon a bit. Any idea why I'm receiving this error? Thanks for your help man
I know you're a busy man and I can see you're all over different stuff but still it would be nice to have an update to the latest saga. I really enjoy rekit and the opinionated approach, it relieves me of busting my head about how to structure things. Thanks for the work so far!
Installning plugin with
rekit install rekit-plugin-redux-saga
then running
rekit add feature user
generate error:
Error: Can't find such file: [PATH TO PROJECT]/src/common/rootSaga.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.