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

Track if scope is settled #687

Closed
AlexandrHoroshih opened this issue May 23, 2022 · 1 comment
Closed

Track if scope is settled #687

AlexandrHoroshih opened this issue May 23, 2022 · 1 comment
Assignees
Labels
fork api RFC Request for Comments

Comments

@AlexandrHoroshih
Copy link
Member

Proposal

I suggest to extend allSettled api like this:

const scope = fork()

allSettled(scope) // Promise, which will be resolved, once there is no pending calculations in this scope

Use case

In some cases there is a need to track, if there are pending effects (like requests) before some action - e.g. before route transition

Something like this:

const onLinkClick = () => {
 allSettled(currentScope).then(() => {
   router.push(...)
 })
}
@AlexandrHoroshih AlexandrHoroshih added the RFC Request for Comments label May 23, 2022
@zerobias zerobias self-assigned this May 23, 2022
@sergeysova sergeysova added this to the effector 23.0.0 milestone Aug 11, 2022
@zerobias zerobias removed this from the effector 23.0.0 milestone Jan 7, 2023
@zerobias
Copy link
Member

zerobias commented Jan 7, 2023

Released in effector 22.5.0

@zerobias zerobias closed this as completed Jan 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fork api RFC Request for Comments
Projects
None yet
Development

No branches or pull requests

3 participants