docs icon indicating copy to clipboard operation
docs copied to clipboard

Docs: Docs do not list all possible machine options keys

Open MichalBryxi opened this issue 2 years ago • 4 comments

Description

Looking at the docs of MachineOptions and it mentions only actions.

But from the Configuring services part of the guides

const userMachine = createMachine(
  {
      // ...
  },
  {
  services: {
    getUser: (context, event) => fetchUser(context.user.id)
  }
);

and Serialising guards

const searchMachine = createMachine(
  {
    // ...
  },
  {
    guards: {
      searchValid: (context, event) => {
        return context.canSearch && event.query && event.query.length > 0;
      }
    }
  }
);

it seems to me that the MachineOptions object can also have services and guards keys? So it should be mentioned in the guides.

Expected result

### Machine options

- `actions?` (object) - a lookup object for your string actions.
- `guards?` (object) - a lookup object for your string guards.
- `services?` (object) - a lookup object for your string services.

Actual result

Confusion? :)

Reproduction

N/A

Additional context

No response

MichalBryxi avatar Mar 22 '22 07:03 MichalBryxi