Skip to content

Commit

Permalink
fix: hook ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
cha0s committed Feb 17, 2024
1 parent 82afeaa commit fcfa90b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 0 additions & 2 deletions docs/gathering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,3 @@ is gathering your files: particularly the `useSubdirectories` flag which is `tru
transformer = camelCase,
}
```

Decorator hooks are [orderable](./ordering).
4 changes: 0 additions & 4 deletions docs/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@ The hook to invoke.

The initial value.

Composed hooks are [orderable](./ordering).

### `invokeMerge`
### `invokeMergeAsync`

Expand Down Expand Up @@ -251,8 +249,6 @@ Invokes all hook implementations, one after another. In the async variant, each

The hook to invoke.

Sequential hooks are [orderable](./ordering.mdx).

### `makeMiddleware` {#invokemiddleware}

Hooks may be implemented in the style of Express middleware.
Expand Down
4 changes: 2 additions & 2 deletions docs/ordering.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: Hint at and explicitly control the order in which things occur.
Suppose we are composing an application and we have HTTP session state using cookies. When a
user hits a route, we need to load their session and subsequently read a value from said session
to determine if the user prefers dark mode. Clearly, we will have to ensure that the session
reification happens first. This is one function of orderable hooks.
reification happens first. Enter hook ordering!

Flecks uses the name of the hook as a configuration key in order to determine the ordering of a
hook. Let's take a core hook as an example, `@flecks/http/server.request.route`:
Expand Down Expand Up @@ -48,7 +48,7 @@ In this application, we first reify the user session as before, but instead of l
`@my-app/finalize` to do some finalization work.

`'...'` essentially translates to: "every implementing fleck which has not already been explicitly
listed in the ordering configuration". The default ordering configuration for any orderable hook is: `['...']`.
listed in the ordering configuration" which is the default ordering configuration for a hook.

Using more than one ellipses entry in an ordering configuration is ambiguous and will throw an
error.
Expand Down

0 comments on commit fcfa90b

Please sign in to comment.