Skip to content

v0.0.11

Choose a tag to compare

@github-actions github-actions released this 27 Oct 22:06
· 7 commits to refs/heads/main since this release
Immutable release. Only release title and notes can be modified.
5d08de3

New

  • isEqualState is an option of initialize. A transition to a state of the same kind that it considers equal is skipped: the state isn't set, so effects and renders don't run again, and the transition you called stays valid. It compares the states without their transition property, and defaults to shallowEqual, which is also exported.
  • @ghostry/finity-solidjs: a case can return a function to render reactively, as in (state) => () => state.kind.

Fixes

  • A state's identity changes only when it is set. value() returned a new object on every call, which made memos and effects that depend on the state run again needlessly.
  • A transition from an earlier render is rejected as stale once a later render has changed the state. Transitions are also checked against the latest state, not the snapshot of the render that created them. In React, that snapshot can be out of date.
  • @ghostry/finity-reactjs: useRender uses the current render's case functions. It memoized the case on the state, so a case kept the values its first render closed over.
  • @ghostry/finity-solidjs: a case renders once when it starts to match, not again on every state change. While it matches, the state it receives reads the latest values, so a transition within the case updates what it rendered. Once it no longer matches, the state keeps its last values, so a late transition is rejected as stale.

Behavior change

  • A transition to an equal state of the same kind does nothing.
  • @ghostry/finity-reactjs and @ghostry/finity-solidjs pass every option to the core package, not only onInvalidTransition.

For integration authors

  • ExhaustiveSwitch takes a fourth type parameter, F, for what a case's function may return. It defaults to R, the result of use.

Docs: Equal states, Rendering, Solid