Skip to content

Commit

Permalink
chore(docs): minor corrections to README docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris-AD committed May 16, 2023
1 parent 4717a40 commit 834a8c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Slotted machines are determined based on the id of the invoked/spawned machine.
`singleSlot` accepts the name of the slot as the first argument and returns an object with a method `getId()` that returns the id of the slot.
`multiSlot` accepts the name of the slot and returns an object with a method `getId(id: string)` that returns the id of the slot

You should always use the `getId` methods when invoking/spawning something into a slot. Each slot the machine has must be represented by a call to `singleSlot` or `multiSlot` and stored into an array of slots. These slots must be passed to the `buildView` and `buildXStateTreeMachine` functions.
You should always use the `getId` methods when invoking/spawning something into a slot. Each slot the machine has must be represented by a call to `singleSlot` or `multiSlot` and stored into an array of slots. These slots must be passed to the `createXStateTreeMachine` function.

### Inter-machine communication

Expand All @@ -182,7 +182,7 @@ That adds two events to the system, a no payload event (`{ type: "BASIC" }`) and
These events can be added anywhere, either next to a component for component specific events or in a module for events that are for multiple machines. One thing that it is important to keep in mind is that these `declare global` declarations must be loaded by the `.d.ts` files when importing the component, otherwise the events will be missing. Which means

1. If they are in their own file, say for a module level declaration, that file will need to be imported somewhere. Somewhere that using a component will trigger the import
2. If they are tied to a component they need to be in the index.ts file that imports the view/selectors/actions etc and calls `buildXstateTreeMachine`. If they are in the file containing those functions the index.d.ts file will not end up importing them.
2. If they are tied to a component they need to be in the index.ts file that imports the view/selectors/actions etc and calls `createXStateTreeMachine`. If they are in the file containing those functions the index.d.ts file will not end up importing them.


### [Storybook](https://storybook.js.org)
Expand Down
4 changes: 2 additions & 2 deletions src/routing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ It is done this way so that you don't need to have handlers at every layer of th
How this works in practice is like so, given the following routes

```typescript
const topRoute = createRoute.simpleROute()({ url: "/foo", event: "GO_FOO" });
const topRoute = createRoute.simpleRoute()({ url: "/foo", event: "GO_FOO" });
const middleRoute = createRoute.staticRoute(topRoute)({ url: "/bar", event: "GO_BAR" });
const bottomRoute = createRoute.staticRoute(middleRoute)({ url: "/qux", event: "GO_QUX" });
```
Expand All @@ -176,7 +176,7 @@ If you were already on the `/foo/bar/qux` url and navigated to the `/foo/bar` ur

### No matching route is found

If it does not find a matching route, either because no routes matched, or because the matching route threw an error parsing the query/params schemas it logs an error message currently
If it does not find a matching route, either because no routes matched, or because the matching route threw an error parsing the query/params schema it logs an error message currently

404 and routing "errors" don't currently have any way to handle them, this will be worked on when it is needed (soon?)

Expand Down

0 comments on commit 834a8c4

Please sign in to comment.