Skip to content

Avoid send calls from effects to happen if the effect is cancelled

Latest

Choose a tag to compare

@ba01ei ba01ei released this 03 Aug 23:09
· 17 commits to main since this release

Previously if you have an effect

.run(id: "...") { send in
  // async logic ...
  await send(action)
}

Cancellation of the effect doesn't guarantee receiving the action. The user must call guard !Task.isCancelled else { return } to ensure the code from this point doesn't run if task is canceled.

With the new change, the send closure used by .run and other effects has guard !Task.isCancelled else { return } built in, so cancellation will prevent action from being sent.