Skip to content

Commit

Permalink
Document the unique id constraint of global interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
kimo-k committed Aug 11, 2023
1 parent 5c4e320 commit d78a039
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/re_frame/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,17 @@
interceptor chain. Any global interceptors you register are effectively
prepending to this chain.
Global interceptors are run in the order that they are registered."
Global interceptors are run in the order that they are registered.
Global interceptors are unique by :id. If a global interceptor with the same :id
key as `interceptor` is already registered, `interceptor` will take its place in the
global interceptor chain. This facilitates hot-reloading.
Note: members of re-frame.std-interceptors do not have unique ids. To register
more than one, consider:
(reg-global-interceptor (-> (re-frame.std-interceptors/on-changes + [:a] [:b])
(assoc :id :my-unique-id)))"
{:api-docs/heading "Global Interceptors"}
[interceptor]
(settings/reg-global-interceptor interceptor))
Expand Down

0 comments on commit d78a039

Please sign in to comment.