Add a generic redux-observable factory automatically handling async-actions - createAsyncEpic #162
Labels
💵 Funded on Issuehunt
This issue has been funded on Issuehunt
high priority
in progress
investigating
new feature
Milestone
Is your feature request related to a real problem or use-case?
While using
Epic
s fromredux-observable
I find myself writing the same code over and over again. It would be great to have an abstraction of this while being properly typed.Describe a solution including usage in code example
Let's say you have a regular async action:
With the corresponding
Epic
:The two pipeable operators
catchErrorAndHandleWithAction
andtakeUntilAction
are defined as:Now the following part inside the
Epic
'sswitchMap
is pretty much the same in every epicThe goal is to abstract this in its own operator that might be used like
As a starting point I already tried
But I am running into problems with the generics and typing of
actions
.I already tried different variations like:
Who does this impact? Who is this for?
People using typescript and
redux-observable
.Describe alternatives you've considered (optional)
Using the
pipe
operator right inside theEpic
works:The signature of that
pipe
is the following:Additional context (optional)
In case you need the type of
HttpError
:IssueHunt Summary
Sponsors (Total: $120.00)
Become a sponsor now!
Or submit a pull request to get the deposits!
Tips
The text was updated successfully, but these errors were encountered: