Comments (2)
Having a side-effect in the Middleware init is a bad practice. The Middleware Protocol avoids that, because you have to receive an action in order to begin side-effects.
Why is a bad practice? Because you create a Middleware and THEN add it to the Store, so when the .init runs, maybe there's no Store to receive actions, that's why "receiveContext" is called once the store is ready, but at that point you may have lost some callbacks from your side-effects.
To solve that, you need a "bootstrap" action to your middleware, it can be a "Void" or a new case into the Action, but definitely your input action can't be "Never" anymore, every side-effect bootstrap needs to be associated to an input action, and a middleware with Input Action == Never can't perform any task.
This is one of the possible solutions:
npvisual/AppLifecycleMiddleware#2
from swiftrex.
thanks 👏
from swiftrex.
Related Issues (20)
- middleware lift with WritableKeyPath doesn't work on AnyMiddleware HOT 2
- Fix animations from Middleware
- Dead-Letter Queue HOT 1
- Memory leak in LiftMiddleware
- When will develop be the official release? HOT 2
- Lift EffectMiddleware using KeyPath not receiving context
- Redundant conformance of 'ASAPScheduler' to protocol 'Scheduler'
- Using await/async in middleware HOT 4
- IO monad and stack limit HOT 6
- Best option for actions triggering other actions ? HOT 28
- Dynamic store HOT 5
- Migrate away from Travis CI HOT 4
- Design question : Model to State migration HOT 2
- Dispatch actions and run reducers on background thread? HOT 4
- CombineRex : Unexpected PublisherType behavior HOT 3
- Trying to use Effect.promise with Firebase's DynamicLinkComponents.shortenURL HOT 5
- Question about assertionFailure() HOT 5
- How organize communication between different states HOT 2
- Improve Tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftrex.