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

Is @config really MachineConfig? #268

Closed
MichalBryxi opened this issue Mar 22, 2022 · 4 comments · Fixed by #418
Closed

Is @config really MachineConfig? #268

MichalBryxi opened this issue Mar 22, 2022 · 4 comments · Fixed by #418

Comments

@MichalBryxi
Copy link
Contributor

The README says:

@config

This argument allows you to pass a MachineConfig for actions, services, guards, etc...

When I look up MachineConfig in the xstate docs I will get to: https://xstate.js.org/docs/packages/xstate-fsm/#machine-config which is defined as:

- id (string) - an identifier for the type of machine this is. Useful for debugging.
- initial (string) - the key of the initial state.
- [states](https://xstate.js.org/docs/packages/xstate-fsm/#state-config) (object) - an object mapping state names (keys) to states
[#](https://xstate.js.org/docs/packages/xstate-fsm/#state-config)

Which does not have actions key as shown in the @config examples:

<Toggle 
  @config={{hash 
    actions=(hash 
      toggleIsOn=@onRoomIlluminated
    )
  }} 

So I think what @config is actually referring to is MachineOptions. Guessing based on createMachine syntax and knowledge how this fits together. So the docs wording should be changed:

#### `@config`
This argument allows you to pass a [MachineOptions](https://xstate.js.org/docs/packages/xstate-fsm/#machine-options) for ...
@MichalBryxi
Copy link
Contributor Author

MichalBryxi commented Mar 22, 2022

If I'm correct, then the name of the argument @config is not fortunate as it does not map 1to1 to xstate terminology. If I'm wrong, then the docs could use some better explanation.

@MichalBryxi
Copy link
Contributor Author

Kidna relates to statelyai/xstate#267

@MichalBryxi
Copy link
Contributor Author

Also note that I created a bug ticket to enhance xstate docs to make it more explicit on their side: statelyai/docs#280

@NullVoxPopuli
Copy link
Owner

I'd be happy to accept a PR changing the docs to say MachineOptions -- maybe also with the type https://paka.dev/npm/[email protected]/api#181eea99810c28a0 since the main docs are presently incomplete?

NullVoxPopuli added a commit that referenced this issue Jul 3, 2022
Resolves: #268

There is a bit of a nomenclature mismatch in XState's docs and that is
reported here: https://github.com/statelyai/xstate/issues/3165
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 a pull request may close this issue.

2 participants