This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-24
Channels
- # adventofcode (13)
- # beginners (163)
- # boot (8)
- # cider (1)
- # clojure (86)
- # clojure-germany (1)
- # clojure-italy (2)
- # clojure-spec (66)
- # clojure-switzerland (1)
- # clojure-uk (25)
- # clojured (1)
- # clojurescript (58)
- # core-async (1)
- # cursive (4)
- # datomic (11)
- # events (1)
- # funcool (3)
- # hoplon (86)
- # off-topic (8)
- # om (11)
- # onyx (1)
- # protorepl (7)
- # re-frame (15)
- # ring-swagger (4)
Hey, trying to upgrade to 0.8.0, have been converting everything over to reg-event-db from register-handler, everything is throwing a warning such as:
re-frame: when registering :profile/send-emails-fail , got a function instead of an interceptor. Did you provide old style middleware by mistake? Got: fndebug[handler]
where the register code looks like:
(re/register-handler
:profile/send-emails-fail re/middleware
(fn [db]
(re/dispatch [:notifications/add-toast {:type :error
:text (str "Error sharing profile, please try again.")
:duration 5}])
(update-in db [:account :profile] dissoc :send-emails)))
(def middleware [(when ^boolean js/goog.DEBUG debug)
dispatch-once-support
re-frame/trim-v])
any ideas what I'm doing wrong? this syntax seems like it should work given the readme
(def trim-event
(re-frame.core/->interceptor
:id :trim-event
:before (fn [context]
(let [trim-fn (fn [event] (-> event rest vec))]
(update-in context [:coeffects :event] trim-fn)))))
@mattsfrey look at the last picture, to understand how interceptors works
For re-frame's event handlers and reg-event-fx
in particular, what are valid return values for our handler functions please? The docs mention that an empty map {}
is ok, per the section https://github.com/Day8/re-frame/blob/master/docs/Effects.md#db-not-always-needed but how about nil
? (seems to work, just want to double-check) Any preference of convention, to express the intention of no further effects? Thanks.
@limist: I think the convention is an empty map, not nil.