Running one reducer on the main queue and another on a background queue #939
Unanswered
mycroftcanner
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Some of my environment clients need to coordinate work between them. If I wrap them into a single environment dependency, this dependency grows to the point that I lose the benefits of having small independent modules and it is becomes harder to test things if a lot of work is done inside the dependency. If I keep the dependencies separate then I am putting a lot of burden on the main queue for coordinating things that don't need to interact with the main queue.
Using two separate stores seems to make sense: one store runs on the main queue and only interfaces with the UI while another store runs in the background dealing with utility work.
What do you guys think is the best approach to do this and allow communication between the two stores?
Here are some of the ideas that came to mind:
Run the background store inside an environment dependency of the main queue reducer. the main queue can just pass actions to the dependency and subscribe to changes to the background state using viewStore publishers.
Keep them separate and share information between the two reducers through the environment only.
Beta Was this translation helpful? Give feedback.
All reactions