Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend ForkedTaskApi to include API #3314

Open
ericanderson opened this issue Mar 31, 2023 · 3 comments · May be fixed by #4363
Open

Extend ForkedTaskApi to include API #3314

ericanderson opened this issue Mar 31, 2023 · 3 comments · May be fixed by #4363

Comments

@ericanderson
Copy link
Contributor

ericanderson commented Mar 31, 2023

Having considered porting a lot of code from saga to listeners, I've noticed that I am reaching for the same pattern which is a bit verbose in order to have deeply nested forking:

Example:

function doThingEvent(action, api) {
  const forks = [];
  await api.pause(
    api.fork((forkApi) => doAnotherThing({ api, ...forkApi }))
  );
}

When in reality, the ForkedTaskApi could just include things from the parent, like getState(), dispatch(), and fork(). Not only would this make the code easier to read api.fork(doAnotherThing)), but it would also mean the type API for both the fork and the task is the same.

@markerikson
Copy link
Collaborator

I'm not sure why we only included the miniature version of the API in fork(), tbh.

Want to try making that change?

@ericanderson
Copy link
Contributor Author

Yeah can look into it next week

@markerikson
Copy link
Collaborator

Still open to having this added!

@markerikson markerikson added this to the 1.9.x milestone Aug 16, 2023
@markerikson markerikson modified the milestones: 1.9.x, 2.x bugfixes Dec 6, 2023
@markerikson markerikson added the listeners label Feb 6, 2024 — with Volta.net
@kkirby kkirby linked a pull request Apr 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants