Skip to content

Commit

Permalink
Document the new :comment ix key
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Jul 17, 2023
1 parent 90805a3 commit 75d85f4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/Interceptors.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ In advanced cases, these two values, within a `context`, can be modified by the
So interceptors can be dynamically added
and removed from `:queue` and `:stack` by Interceptors already in the chain.

## Self Documenting

An interceptor has a required `:id` key, and an optional `:comment` key.
Re-frame itself does not take any special action in response to these keys.
Instead, they can offer situational awareness to you or your tools.
For instance, the [standard interceptor](#appendix-built-in-interceptors)
__path__ adds a `:comment` describing _which_ path it goes to.

## Credit

> All truths are easy to understand once they are discovered <br>
Expand Down Expand Up @@ -392,7 +400,7 @@ And some Interceptor factories (functions that return Interceptors):

- __enrich__: perform additional computations (validations?), after the handler has run. More derived data flowing.
- __after__: perform side effects, after a handler has run. Eg: use it to report if the data in `app-db` matches a schema.
- __path__: a convenience. Simplifies our handlers. Acts almost like `update-in`.
- __path__: a convenience. Simplifies our handlers. Acts almost like `update-in`, to get and set a subtree of the app-db. Stores the path of the subtree in its `:comment`.

In addition, [a Library like re-frame-undo](https://github.com/day8/re-frame-undo) provides an Interceptor
factory called `undoable` which checkpoints app state.
Expand Down

0 comments on commit 75d85f4

Please sign in to comment.