Skip to content

v1.8.3

Compare
Choose a tag to compare
@github-actions github-actions released this 09 Jun 07:25
· 148 commits to refs/heads/main since this release
85972a3

🐛 Bug Fixes

  • fix condition method calling else branch when then branch changes predicate #204 (@sergeysova)

📚 Documentation

🚀 Experimental

  • Added experimental operators and, or, not, either, equals

They're allow us to write logical conditions easily without much combines and maps:

// without logical operators

const $userExists = $user.map(user => user !== null);
const $isAttemptsMaximum = $numberOfAttempts.map(attempts => attempts >= ATTEMPTS_MAXIMUM);
sample({
  clock,
  source,
  filter: combine(
    $isAttemptsMaximum,
    $cardActivated,
    $restricted,
    $userExists,
    (isAttemptsMaximumx, activated, restricted, userExists) => !isAttemptsMaximum && activated && !restricted && userExists,
  ),
  target,
})
// with these logical operators

const $isAttemptsMaximum = $numberOfAttempts.map(attempts => attempts >= ATTEMPTS_MAXIMUM)
sample({
  clock,
  source,
  filter: and(
    not($isAttemptsMaximum),
    $cardActivated,
    not(equals($user, null)),
    not($restricted),
  ),
  target,
})

It is experimental! Use on your own risk. Each method create a new store and calls combine under the hood.