Skip to content

Track if scope is settled #687

@AlexandrHoroshih

Description

@AlexandrHoroshih

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(...)
 })
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions