Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for invoke source object #1320

Merged
merged 6 commits into from
Jul 26, 2020
Merged

Conversation

davidkpiano
Copy link
Member

@davidkpiano davidkpiano commented Jul 19, 2020

This PR adds support for invoke source objects. This is not a breaking change; src: 'someString' will continue to work.

invoke: {
  src: {
    type: 'search',
    endpoint: 'google.com'
  },
  // ...
}

// ...

services: {
  search: (ctx, e, { src }) => {
    console.log(src);
    // => { type: 'search', endpoint: 'google.com' }
  }
}

// ...

TODO:

  • Documentation
  • Changeset

@changeset-bot
Copy link

changeset-bot bot commented Jul 19, 2020

🦋 Changeset is good to go

Latest commit: 01e3e2d

We got this.

This PR includes changesets to release 8 packages
Name Type
@xstate/fsm Minor
xstate Minor
@xstate/react Major
@xstate/vue Major
@xstate/analytics Major
@xstate/graph Major
@xstate/immer Major
@xstate/test Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 21, 2020

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 01e3e2d:

Sandbox Source
XState Example Template Configuration
XState React Template Configuration

@davidkpiano
Copy link
Member Author

@Andarist LGTY?

@@ -678,3 +679,13 @@ export function evaluateGuard<TContext, TEvent extends EventObject>(

return condFn(context, _event.data, guardMeta);
}

export function toInvokeSource(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a similar one is already available in packages/core/src/invokeUtils.ts - any reason for having both?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That file doesn't exist, link?

@davidkpiano davidkpiano merged commit 16b602c into master Jul 26, 2020
@davidkpiano davidkpiano deleted the davidkpiano/invoke-config branch July 26, 2020 14:06
This was referenced Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants