Skip to content

v0.0.5

Choose a tag to compare

@github-actions github-actions released this 01 Jul 03:15
· 30 commits to refs/heads/main since this release
Immutable release. Only release title and notes can be modified.
b7f68ca

Breaking changes

  • onInvalidTransition receives an InvalidTransitionError instead of { from, to }. Its reason is "disallowed" or "stale". Its state holds the definition's name (from defineTransitionalState(name)), from, and to, and its tick holds the clock ticks behind a stale transition. Throw it to fail loudly, or report it.
    initialize({
      onInvalidTransition: (error) => {
        throw error;
      },
    });
  • case([...]) is a type error when its list names the same kind twice.

New

  • Stale transitions are rejected. A state's transition belongs to the state it came with. Once the state has changed through any set, update, or transition, calling an earlier transition does nothing and reports a "stale" InvalidTransitionError. This keeps a slow effect, such as a request that resolves after the user has moved on, from overwriting a newer state.
  • InvalidTransitionError is exported.
  • The packages are published to JSR as well as npm.

Fixes

  • @ghostry/finity-reactjs: set and update return the new state. They returned the updater function instead.

Docs: Invalid transitions, Stale transitions