Repository navigation
v0.0.11
·
7 commits
to refs/heads/main
since this release
Immutable
release. Only release title and notes can be modified.
New
isEqualStateis an option ofinitialize. A transition to a state of the samekindthat it considers equal is skipped: the state isn't set, so effects and renders don't run again, and thetransitionyou called stays valid. It compares the states without theirtransitionproperty, and defaults toshallowEqual, 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
transitionfrom 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:useRenderuses 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 latetransitionis rejected as stale.
Behavior change
- A transition to an equal state of the same
kinddoes nothing. @ghostry/finity-reactjsand@ghostry/finity-solidjspass every option to the core package, not onlyonInvalidTransition.
For integration authors
ExhaustiveSwitchtakes a fourth type parameter,F, for what a case's function may return. It defaults toR, the result ofuse.
Docs: Equal states, Rendering, Solid