Avoid wrapping behaviorImpl in a throwaway function#3281
Avoid wrapping behaviorImpl in a throwaway function#3281Andarist merged 1 commit intov5/improved-spawn-1from
behaviorImpl in a throwaway function#3281Conversation
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 57f394b:
|
CodeSee Review Map:Review in an interactive map View more CodeSee Maps Legend |
d58b75a to
57f394b
Compare
* All tests pass! * Fix all tests * Some types cleanup * Fix types WIP * Add TODOs for types * Skip questionable test * Remove stray console logs * Add `spawn.machine` * Add `spawn.promise` * Add `spawn.observable` * Add tests for referenced behaviors * Revert "Add `spawn.observable`" This reverts commit 6df48b5. * Revert "Add `spawn.promise`" This reverts commit 9fce5a9. * Revert "Add `spawn.machine`" This reverts commit 0a3ac9f. * Cleanup * Temp fix for string references * Ignore excessive stack depth warnings * This actually passes * Remove invoke* * Rename createDeferredBehavior -> createCallbackBehavior * Make getContextAndActions private * Fix & clarify unskipped test * Add test from todo * Clean up test * Make parent "private" * Make sure children is "immutable" (+ todos) * Revert initialState change * Add comment * Oops * Remove invoke* functions (except for invokeMachine) * Quell 1 type error * Fixed the conditional type in the `interpret` * Bring back removed `spawn` type test * Tweak one `assign` test * Remove lazy argument from `createMachineBehavior` and remove `invokeMachine` entirely * Add a TODO comment about hiding `ActorRef["_parent"]` * Require a machine with all implementations provided as an argument for `createMachineBehavior` * Cache the `initialState` getter in `createMachineBehavior` * Unwrap `createCallbackBehavior` argument from a redundant lazy layer * Renaming WIP * Renaming WIP * Add back spawnBehavior but call it createActorRef * behaviors -> actors * Tweak tests * Remove Actor class * Remove actor.ts * Fix missing function * Remove createBehaviorFrom * Make behavior private * Add onEmit and remove complete * Tighten up types (a little) * Fix types * Remove createBehaviorFrom * No more magic events * Update packages/core/src/actors.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update packages/core/src/types.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Fix types * Fix sendError (send raw error data, not events) * Attempt to fix type * Fix type * Rename onEmit -> onSnapshot * Rename types: TEmitted -> TSnapshot * Change src to allow behaviors directly (WIP) * Fix type errors * Add back InvokeSrcDefinition for now * Add fromEventObservable * Remove outdated `xstate/behaviors` references (#3280) * Avoid wrapping `behaviorImpl` in a throwaway function (#3281) * Update packages/core/test/actions.test.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update packages/xstate-svelte/src/useSelector.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update packages/xstate-svelte/src/useSelector.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update packages/xstate-vue/src/useSelector.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Update packages/xstate-vue/src/useSelector.ts Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com> * Remove unused type * Remove subscriptions from behaviors (they belong on ObservableActorRef only) * Add TODO * Remove unused type * Refactor: do not use observers for invoked promises * Remove latestData logic in interpreter * Remove observer logic from fromObservable/fromObservableEvent * Remove observers * Remove subscription logic from interpreter * Remove unused type * Fixed `ObservableActorRef` subscriptions and remove some outdated/redundant code (#3319) * Fixed `ObservableActorRef` subscriptions and remove some outdated/redundant code * Add changesets * Remove `createActorRef` * Make `Interpreter#nextState` pure again (#3340) * Rename `EmittedFrom` to `SnapshotFrom` (#3341) * Add changesets Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>

No description provided.