Skip to main content

v0.14.0

cotton-box

  • ReadOnlyStateManager type now exposes the name property.

cotton-box-react

  • Fixed a bug where the error below might be thrown under some circumstances:

    Cannot use 'in' operator to search for 'name' in undefined

  • useSimpleStateValueWithReactiveSelector and useStateValueWithReactiveSelector has been marked as deprecated and will most likely be removed in the next major version (v0 -> v1). If you use this hook and find a valid use case, please create an issue to explain your use case.

v0.13.1

cotton-box

  • Internal code optimizations with TypeScript strict mode enabled.

cotton-box-react

  • Internal code optimizations with TypeScript strict mode enabled.

v0.13.0

cotton-box

  • N/A

cotton-box-react

  • Added missing export.

v0.12.0

cotton-box

  • Added experimental hydration API for when server-side rendering is involved.

cotton-box-react

  • Added experimental hydration API for when server-side rendering is involved.

v0.11.0

cotton-box

  • Fixed incorrect type definition for trySet

cotton-box-react

  • N/A

v0.10.0

cotton-box

  • Added trySet method to SimpleFiniteStateManager.
  • Parameter stateManagerName of InvalidStateTransitionError has been renamed to stateManager for brevity.
  • Constructor parameters of InvalidStateTransitionError (fromState, toState, stateManager) are now also available as public readonly properties.

cotton-box-react

  • N/A

v0.9.0

cotton-box

  • Fixed a bug where SimpleFiniteStateManager would throw "TypeError: Cannot read properties of undefined (reading 'has')" when setting state under certain circumstances.
  • The constructor of InvalidStateTransitionError now accepts a third optional parameter stateManagerName.
  • Watcher.refresh has now been renamed to .post. The .refresh method is still available but will be removed in a future version.

cotton-box-react

  • N/A

v0.8.0

cotton-box

  • Added helper type StateTransition.

cotton-box-react

  • Updated type definitions for hooks to accept SimpleFiniteStateManager and ReadonlyStateManager.

v0.7.0

cotton-box

  • Added SimpleFiniteStateManager, a sub-class of SimpleStateManager that only allows state change according to a set of predefined state transitions.

cotton-box-react

  • N/A

v0.6.0

cotton-box

  • The Equality API has been removed — it now exists as a separate package: @glyph-cat/equality.

cotton-box-react

  • N/A

v0.5.0

cotton-box

  • N/A

cotton-box-react

  • Updated post-install script.
  • Removed Scope-related APIs (StateManagerScopeProviderProps, StateManagerScopeProvider, useScoped) to reduce complexity of the library.

v0.4.0

cotton-box

  • The Watcher that Cotton Box uses internally is now exposed as a public API.
  • Internal stability enhancements.

cotton-box-react

  • Internal stability enhancements.

v0.3.0

cotton-box

  • Fixed incorrect export name for UMD builds.
  • Events captured by .watch now includes StateChangeEventType as the second parameter.
  • Events captured by .wait now includes StateChangeEventType as the third parameter.
  • Type safety enhancements.
  • Internal optimizations.

cotton-box-react

  • Fixed incorrect export name for UMD builds.
  • Fixed a bug where error "Cannot read properties of null (reading 'name')" would be thrown in production.
  • Internal optimizations.

v0.2.0

cotton-box

  • The isInitializing property of StateManager and AsyncStateManager is now exposed as a ReadOnlyStateManager.
  • Removed method .waitForInit in favor of calling ….isInitializing.wait(false) directly.
  • State Managers without names will be assigned automatic names (UnnamedStateManager_001, UnnamedStateManager_002, and so on).

cotton-box-react

useInitState has been removed in favor of a more direct way to find out if a State Manager is initializing:

- const isInitializing = useInitState(ExampleState)
+ const isInitializing = useSimpleStateValue(ExampleState.isInitializing)

The way useInitState works internally is also similar to calling useSimpleStateValue. By having one less hook means the codebase will have less complexity and becomes easier to maintain.

On top of that, now that isInitializing is exposed as a State Manager itself, this means it is also possible to watch for the changes and even use it with other UI libraries/frameworks such as Vue and Angular with significantly less friction.

v0.1.0

cotton-box

  • The wait method now will only wait for the state to match or evaluator to return true, without checking if the state is currently initializing.
  • Added new method waitForInit to StateManager and AsyncStateManager
  • Added new method reinitialize to StateManager and AsyncStateManager
  • currentState is now exposed in the lifecycle.init callback
  • New property isInitializing exposed for StateManager and AsyncStateManager

cotton-box-react

  • Added new hook useInitState

v0.0.2

cotton-box

  • Stability enhancements.

cotton-box-react

  • Passing StateManager and AsyncStateManager to useSimpleStateValue and useSimpleStateValueWithReactiveSelector will not cause an error to be thrown. This is the same behavior as v0.0.0. Instead, rely on TypeScript's type-checking to prevent passing the wrong State Manager type. This change is made to reduce some runtime overhead in the hooks by not having to validate the State Manager types.

v0.0.1

cotton-box

  • Fixed a bug where the didReset lifecycle hook is called during initialization via commit.

cotton-box-react

  • Passing StateManager and AsyncStateManager to useSimpleStateValue and useSimpleStateValueWithReactiveSelector will now cause an error to be thrown.

v0.0.0

  • Initial release / pre-release