Add an aliveFlow
that only calls .next()
when the tree is still alive
#1950
Labels
enhancement
Possible enhancement
help/PR welcome
Help/Pull request from contributors to fix the issue is welcome
level: intermediate
Feature request
Add an
aliveFlow
that only calls.next()
when the tree is still alive.Also add something like the following to the async action doc.
CAVEAT: when running an async action, the tree might be destroyed before the promise is resolved, leading to errors
.Is your feature request related to a problem? Please describe.
This is very useful when running async actions on tree nodes that might be replaced.
For instance, I might have a
SessionStore
that fetch and update the session token automatically when it expires.If the
SessionStore
is replaced (e.g. due to user switching to a different account), I'd love to abort any running async actions.Note that this is different from #691 which requires cancelling the flow manually. #691 is less ergonomic when the
flow
is attached to a lifecycle hook.Describe the solution you'd like
It can be implemented as
Are you willing to (attempt) a PR?
The text was updated successfully, but these errors were encountered: