First of all many props for this awesome library! I am still struggling with an use case though. I would like to call another epic first and wait till it completes before continuing the current epic. Let's say I have a form where an user can change things. Before loading other data into the form, I want to save the current changes first. Any thoughts on this?
相关问题
- How to toggle on Order in ReactJS
- Refreshing page gives Cannot GET /page_url in reac
- Adding a timeout to a render function in ReactJS
- React Native Inline style for multiple Text in sin
- Issue with React.PropTypes.func.isRequired
相关文章
- Cannot find module 'redux' 怎么解决?
- Why would we use useEffect without a dependency ar
- is there any difference between import { Observabl
- Angular material table not showing data
- Is it possible to get ref of props.children?
- Stateless function components cannot be given refs
- React testing library: Test attribute / prop
- React/JestJS/Enzyme: How to test for ref function?
@jayphelps, I just wanted to say thank you for the all questions you have answered, they have really helped me solve many of my problems.
I was trying to formulate my question and found that you had already answered it here and managed to use your sample to fix my problem.
My example has/had 2 expics that I want/ed to call after each other:
The way I managed to solve it was using:
So dispatching REQUEST_NAME would also dispatch REQUEST_AGE, but then I would never be able to only dispatch LOAD_NAME.
I refactored your sample to get:
Thank you again for all the great work you do on redux-observable and all the community support.
Sounds like you want: if one epic would like to kick off another epics work and wait for it to complete before proceeding.
One approach is (using pseudo names), when receiving the initial action
LOAD_OTHER_DATA
you immediately start listening for a singleSAVE_FORM_FULFILLED
, which signals that the form has been saved (we'll kick it off in a bit). When received, wemergeMap
(orswitchMap
, doesn't matter in this case) that into our call to load the other dataloadOtherDataSomehow()
and do the usual business. Finally, the trick to kick off the actual saving of the form we're waiting for is adding astartWith()
at the end of that entire chain--which will emit and dispatch the action to actually save the form.You didn't mention how your loading and saving works, so this is just pseudo code that you'll need to amend for your use case.