Skip to content

Commit 462e0b2

Browse files
Version Packages (#5405)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b8ec3b1 commit 462e0b2

File tree

3 files changed

+40
-39
lines changed

3 files changed

+40
-39
lines changed

.changeset/solid-spies-wink.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/core/CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# xstate
22

3+
## 5.24.0
4+
5+
### Minor Changes
6+
7+
- [#5371](https://github.com/statelyai/xstate/pull/5371) [`b8ec3b1`](https://github.com/statelyai/xstate/commit/b8ec3b153fbacae078c03cd07678271e0456679a) Thanks [@davidkpiano](https://github.com/davidkpiano)! - Add `setup.extend()` method to incrementally extend machine setup configurations with additional actions, guards, and delays. This enables composable and reusable machine setups where extended actions, guards, and delays can reference base actions, guards, and delays and support chaining multiple extensions:
8+
9+
```ts
10+
import { setup, not, and } from 'xstate';
11+
12+
const baseSetup = setup({
13+
guards: {
14+
isAuthenticated: () => true,
15+
hasPermission: () => false
16+
}
17+
});
18+
19+
const extendedSetup = baseSetup.extend({
20+
guards: {
21+
// Type-safe guard references
22+
isUnauthenticated: not('isAuthenticated'),
23+
canAccess: and(['isAuthenticated', 'hasPermission'])
24+
}
25+
});
26+
27+
// Both base and extended guards are available
28+
extendedSetup.createMachine({
29+
on: {
30+
LOGIN: {
31+
guard: 'isAuthenticated',
32+
target: 'authenticated'
33+
},
34+
LOGOUT: {
35+
guard: 'isUnauthenticated',
36+
target: 'unauthenticated'
37+
}
38+
}
39+
});
40+
```
41+
342
## 5.23.0
443

544
### Minor Changes

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xstate",
3-
"version": "5.23.0",
3+
"version": "5.24.0",
44
"description": "Finite State Machines and Statecharts for the Modern Web.",
55
"main": "dist/xstate.cjs.js",
66
"module": "dist/xstate.esm.js",

0 commit comments

Comments
 (0)