Skip to content
Logo

Changelog

for @ghostry/finity-reactjs

Every release of @ghostry/finity-reactjs, newest first. Releases up to v0.0.12 covered all three finity packages under one version.

v0.0.13

· Release on GitHub

New

  • FinityError is exported as a type, alongside InvalidTransitionError. It's the base of every error finity creates, with its subclasses in its namespace: FinityError.InvalidTransitionError. For an instanceof check, import the class from @ghostry/finity-core.

Behavior change

  • The error onInvalidTransition receives is named "@ghostry/finity-core:InvalidTransitionError", where it was "Error".

Compatibility

  • Depends on @ghostry/finity-core 0.0.13 exactly. If you also import from finity-core directly, for noop, never, shallowEqual, or an instanceof check, install 0.0.13 so only one copy is installed.
  • package.json declares engines.node >=20.0.0 and sideEffects: false.

Internal

  • Each finity package has its own version and release, tagged finity-reactjs/vX.Y.Z. Releases up to v0.0.12 covered all three packages under one version.
  • Tests run on bun test.

Docs: FinityError, Installation

v0.0.12

· Release on GitHub

Fixes

  • Types resolve for consumers on moduleResolution: node16 or nodenext. The published declarations imported their sibling files without an extension, which those modes reject for an ESM package. Under skipLibCheck: true there was no error: every export was silently typed as any. Every relative import in dist/types now names its file.

Internal

  • The build type-checks the emitted declarations, so a broken dist/types fails the build instead of shipping.

v0.0.11

· Release on GitHub

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

v0.0.10

· Release on GitHub

Fixes

  • UsingTransitionalState and UsingStrictlyTransitionalState are exported again, from all three packages. They give the type of a used state from its definition.
    type State = UsingStrictlyTransitionalState<typeof State>;
    

v0.0.9

· Release on GitHub

Fixes

  • require() no longer points at CommonJS files that don't exist. The packages are ES modules only, and package.json no longer declares main or a require condition.
  • @ghostry/finity-reactjs and @ghostry/finity-solidjs re-export the core types again: Config, ExhaustiveSwitch, ExhaustiveSwitchInstance, Getter, InvalidTransitionError, Setter, TransitionalState, and TransitionalStates.

v0.0.8

· Release on GitHub

Compatibility

  • Published to JSR again, after 0.0.5. Every exported function declares its return type, which JSR requires.

Internal

  • UseStrictlyTransitionalStateHook names the type of the useStrictlyTransitionalState hook.

v0.0.7

· Release on GitHub

Breaking changes

  • @ghostry/finity-core exports only its public API. That's initialize, never, noop, InvalidTransitionError, ExhaustiveSwitchInstance, and the types Config, Getter, Setter, ExhaustiveSwitch, TransitionalState, TransitionalStates, and Initialized. Its internal types are no longer exported. UsingTransitionalState and UsingStrictlyTransitionalState return in 0.0.10.
  • @ghostry/finity-reactjs and @ghostry/finity-solidjs no longer re-export the core package's types. Import them from @ghostry/finity-core until 0.0.9 restores them.

Compatibility

  • Not published to JSR. JSR goes from 0.0.5 to 0.0.8.

Internal

  • Every exported symbol has a doc comment.

v0.0.6

· Release on GitHub

Breaking changes

  • The packages ship ES modules only. The CommonJS and UMD builds are removed, along with source maps. The require condition in package.json still points at the removed CommonJS build, so require() fails until 0.0.9.

Compatibility

  • Not published to JSR. JSR goes from 0.0.5 to 0.0.8.

v0.0.5

· Release on GitHub

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

v0.0.4

· Release on GitHub

Breaking changes

  • assertNever is renamed never.
  • State values must be non-nullish. useState, Getter, Setter, and a custom integration's Config.useState now constrain their type to T extends {}.

New

  • onInvalidTransition is an option of initialize in every package. It's called with { from, to } when transition() asks for a transition that the state's definition doesn't allow.

Behavior change

  • A disallowed transition no longer throws. The state stays as it is, and onInvalidTransition is called if it's set. The types already reject a disallowed transition() call, so this only happens through a cast.

Compatibility

  • The build output targets ES2015 instead of ES5.

Docs: Invalid transitions

v0.0.3

· Release on GitHub

Fixes a bug with the React library that prevented it from working.