Skip to content

Commit

Permalink
Add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Jul 12, 2020
1 parent 42ead53 commit a7da145
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .changeset/forty-waves-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
'xstate': patch
---

The "Attempted to spawn an Actor [...] outside of a service. This will have no effect." warnings are now silenced for "lazily spawned" actors, which are actors that aren't immediately active until the function that creates them are called:

```js
// ⚠️ "active" actor - will warn
spawn(somePromise);

// 🕐 "lazy" actor - won't warn
spawn(() => somePromise);

// 🕐 machines are also "lazy" - won't warn
spawn(someMachine);
```

It is recommended that all `spawn(...)`-ed actors are lazy, to avoid accidentally initializing them e.g., when reading `machine.initialState` or calculating otherwise pure transitions. In V5, this will be enforced.

0 comments on commit a7da145

Please sign in to comment.