This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-18
Channels
- # adventofcode (326)
- # aws (1)
- # beginners (67)
- # cider (52)
- # cljs-dev (5)
- # cljsrn (5)
- # clojure (104)
- # clojure-art (2)
- # clojure-austin (34)
- # clojure-france (12)
- # clojure-greece (38)
- # clojure-india (2)
- # clojure-italy (6)
- # clojure-spec (11)
- # clojure-uk (32)
- # clojurescript (51)
- # core-async (5)
- # cursive (11)
- # data-science (5)
- # datascript (3)
- # datomic (3)
- # defnpodcast (7)
- # fulcro (26)
- # graphql (10)
- # hoplon (1)
- # instaparse (2)
- # jobs (1)
- # klipse (3)
- # lumo (13)
- # off-topic (50)
- # om (2)
- # onyx (19)
- # parinfer (1)
- # pedestal (4)
- # re-frame (18)
- # ring-swagger (1)
- # spacemacs (1)
- # specter (42)
- # sql (9)
- # uncomplicate (18)
- # unrepl (13)
@raymcdermott You have gap
argument.
template.cljs?rel=1513207500959:302 Uncaught Error: Assert failed: Invalid Hiccup form: [nil :size "1"]
I think it's better to use aliases for namespaces like (require '[re-com.core :as rc])
and then use rc/gap
, rc/label
etc to avoid errors like this.
@raymcdermott just to confirm this is a name shadowing issue, not specific to re-com
re-frame-trace 0.1.14 is out now: https://github.com/Day8/re-frame-trace/releases/tag/0.1.14
And a new demo video: https://github.com/Day8/re-frame-trace#a-visual-sampler
Assuming the ::form-errors?
subscription is updated by the ::validate-form
dispatch. What is the best way to ensure it is done running before checking the errors and dispatching the ::submit-form
?
(defn submit-button []
[:button#submit-button {:type "submit"
:on-click (fn [e]
(rf/dispatch [::validate-form])
(when (not @(rf/subscribe [::form-errors?]))
(rf/dispatch [::submit-form])))}
"Submit"])
@jarrodctaylor you can use the :dispatch
effect that is provided with re-frame
from a single form submission event handler
(rf/reg-event-fx
::validated-submission
(fn [{:keys [db]} event-vec]
(let [errors (do-validation <whatever needed>)]
(if (empty? errors)
{:dispatch [::submit-form]}
{:db (assoc db ::form-errors errors)}))))
Makes sense. Thanks.