Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Jul 21, 2020
1 parent dcb99d8 commit 4dbabfe
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .changeset/swift-pigs-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
'xstate': minor
---

The `invoke.src` property now accepts an object that describes the invoke source with its `type` and other related metadata. This can be read from the `services` option in the `meta.src` argument:

```js
const machine = createMachine(
{
initial: 'searching',
states: {
searching: {
invoke: {
src: {
type: 'search',
endpoint: 'example.com'
}
// ...
}
// ...
}
}
},
{
services: {
search: (context, event, { src }) => {
console.log(src);
// => { endpoint: 'example.com' }
}
}
}
);
```

Specifying a string for `invoke.src` will continue to work the same; e.g., if `src: 'search'` was specified, this would be the same as `src: { type: 'search' }`.

0 comments on commit 4dbabfe

Please sign in to comment.