From 1a6066348c31f8564f9f1568b6e16cf63b9f9ff0 Mon Sep 17 00:00:00 2001 From: Mike Thompson Date: Wed, 4 Jan 2017 07:00:34 +1100 Subject: [PATCH] Improve comment on enrich --- docs/SubscriptionFlow.md | 6 +++--- src/re_frame/std_interceptors.cljc | 17 ++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/docs/SubscriptionFlow.md b/docs/SubscriptionFlow.md index a246f74..e48c700 100644 --- a/docs/SubscriptionFlow.md +++ b/docs/SubscriptionFlow.md @@ -206,10 +206,10 @@ On with the rest of my lies and distortions... ### reg-sub-raw -This low level part of the API, provides a way to register a subscription handler - so +This low level part of the API provides a way to register a subscription handler - so the intent is similar to `reg-sub`. -You use it like you do other registration functions: +You use it like other registration functions: ```clj (re-frame.core/reg-sub-raw ;; it is part of the API :query-id ;; later use (subscribe [:query-id]) @@ -231,7 +231,7 @@ As a result of point 3, each time `app-db` changes, the wrapped `reaction` will `app-db` is an input signal to that `reaction`. Unlike `reg-sub`, there is no 3-arity version of `reg-sub-raw`, so there's no way for you to provide an input signals function. -Instead, even simpler, you can use `subscribe` within the `reaction` itself. For example: +Instead, even simpler, you can just use `subscribe` within the `reaction` itself. For example: ```clj (defn some-fn [app-db event] diff --git a/src/re_frame/std_interceptors.cljc b/src/re_frame/std_interceptors.cljc index 6fd8c7f..7eb0c2b 100644 --- a/src/re_frame/std_interceptors.cljc +++ b/src/re_frame/std_interceptors.cljc @@ -200,16 +200,19 @@ Almost any action (edit text, add new todo, remove a todo) requires a complete reassesment of duplication errors and warnings. Eg: that edit - update might have introduced a new duplicate or removed one. Same with a - todo removal. + just made might have introduced a new duplicate, or removed one. Same with + any todo removal. - And to perform this enrichment, a function has to inspect all the todos, - possibly set flags on each, and set some overall list of duplicates. - And this duplication check might just be one check among many. + And, to perform this enrichment, a function has to inspect all the todos, + possibly set flags on each, and calculate some overall list of duplicates + (displayed at the bottom?). And this duplication check might just be one + check among many. `f` would need to be both adding and removing the duplicate warnings. - By applying `f` in an `:after` interceptor, we keep the handlers - simple and yet we ensure this important step is not missed." + It would need to completely recompute all warnings, from scratch every time. + By applying `f` in an `:enrich` interceptor, we keep the handlers + simple and yet we ensure this important step (of getting warnings right) + is not missed on any change." [f] (->interceptor :id :enrich