Skip to content

Commit

Permalink
Version Packages (#5076)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Sep 16, 2024
1 parent 84aca37 commit 9d0c1e1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 56 deletions.
29 changes: 0 additions & 29 deletions .changeset/moody-days-develop.md

This file was deleted.

26 changes: 0 additions & 26 deletions .changeset/silver-maps-grab.md

This file was deleted.

52 changes: 52 additions & 0 deletions packages/xstate-store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
# @xstate/store

## 2.4.0

### Minor Changes

- [#5064](https://github.com/statelyai/xstate/pull/5064) [`84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47`](https://github.com/statelyai/xstate/commit/84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47) Thanks [@davidkpiano](https://github.com/davidkpiano)! - There is a new single-argument config API for `createStore(config)`:

```ts
const store = createStore({
// Types (optional)
types: {
emitted: {} as { type: 'incremented' }
},

// Context
context: { count: 0 },

// Transitions
on: {
inc: (context, event: { by: number }, enq) => {
enq.emit({ type: 'incremented' });

return { count: context.count + event.by };
},
dec: (context, event: { by: number }) => ({
count: context.count - event.by
})
}
});
```

- [#5064](https://github.com/statelyai/xstate/pull/5064) [`84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47`](https://github.com/statelyai/xstate/commit/84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47) Thanks [@davidkpiano](https://github.com/davidkpiano)! - You can now emit events from a store:

```ts
import { createStore } from '@xstate/store';
const store = createStore({
context: {
count: 0
},
on: {
increment: (context, event, { emit }) => {
emit({ type: 'incremented' });
return { count: context.count + 1 };
}
}
});
store.on('incremented', () => {
console.log('incremented!');
});
```

## 2.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/xstate-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xstate/store",
"version": "2.3.0",
"version": "2.4.0",
"description": "Simple stores",
"keywords": [
"store",
Expand Down

0 comments on commit 9d0c1e1

Please sign in to comment.