Skip to content

Releases

v1.0.0

Choose a tag to compare

@mikhaelesa mikhaelesa released this 29 Jun 09:09
b3c3d27

Release Summary: Store v1.0 - Async Action Support

We are excited to announce the release of Store v1.0, which includes robust support for asynchronous actions, enhancing the flexibility and power of state management in your applications.

Key Features:

Async Action Support:

The Store class now supports asynchronous actions, allowing you to perform async operations (e.g., API calls) seamlessly within your state management logic.
Asynchronous actions can be defined using async functions, enabling straightforward handling of complex state changes that depend on external data or processes.

Type Safety:

Our implementation ensures type safety, maintaining strong TypeScript support for both synchronous and asynchronous actions.
Type definitions (IStoreConfigs, TAction, TSubscriber, TMiddleware) have been updated to accommodate async actions without compromising on type safety.

Middleware Integration:

Middleware continues to operate seamlessly with async actions, allowing you to intercept, modify, or log actions as needed.
The middleware chain correctly handles asynchronous operations, ensuring that your middleware logic remains consistent and reliable.

Subscriber Notifications:

Subscribers are notified of state changes triggered by async actions, ensuring that your UI and other dependent components are always in sync with the latest state.
The notify method ensures subscribers receive updates once the async action completes and the state is updated.

Backward Compatibility:

Existing synchronous actions and their dispatch mechanisms continue to work without any modifications, ensuring a smooth transition to v1

v0.3.0

Choose a tag to compare

@mikhaelesa mikhaelesa released this 23 Jun 12:44
2632dc0
  • Created MiddlewareManager class for managing middlewares and applying middlewares.
    • Every middleware are unique, which mean there won't be any duplicated middleware even though the user inserted multiple duplicate middlewares.
    • Middleware should return next, if not then the chain will be broken and cannot finish.
  • Refactor apply from recursive to loop.
  • Store checks middleware chain status before invoked. If chain failed then action won't be invoked.
  • Created NextFunction type
  • Updated README.md
  • Fixed apply to not only check for undefined but also falsy
  • Created test cases for MiddlewareManager
  • Created TMiddleware for the base type of creating and applying middleware
  • Store accepts middlewares as optional configuration.

v0.2.0

Choose a tag to compare

@mikhaelesa mikhaelesa released this 23 Jun 12:03
f446f25
  • Created new CombineStores class for combining multiple individual stores to have a single source of truth.
    • User can then select which store they want to interact with via getStore
    • TypeSafety to ensure users don't interact with a non-existent store.
  • Upgraded TypeScript to v5.5.2.
  • Improved dispatch second parameter type using tuples.
    • The second parameter now depends fully on the actions. If the action has payload and the user is dispatching that action, then it will ask for a second parameter and vice versa.
  • Updated store test cases.
  • Created test cases for CombineStores.
  • Update some package.json properties

v0.1.1

Choose a tag to compare

@mikhaelesa mikhaelesa released this 23 Jun 12:02
f446f25
  • Removed getOne and fully rely on get.

v0.1.0

Choose a tag to compare

@mikhaelesa mikhaelesa released this 18 Jun 11:21
  • Created Store class to hold the states and actions
    • Users can further interact with the store via methods that are provided by the Store itself
      • dispatch method to dispatch actions
      • get to get all properties of state
      • subscribe when there is a change, the subscriber will be notified
      • unsubscribe to unsubscribe and will no longer receive notification
  • Write test cases for Store