This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-23
Channels
- # admin-announcements (1)
- # announcements (1)
- # beginners (222)
- # boot (210)
- # cider (26)
- # cljs-dev (50)
- # cljsrn (19)
- # clojure (243)
- # clojure-art (12)
- # clojure-finland (1)
- # clojure-poland (43)
- # clojure-russia (46)
- # clojure-sg (13)
- # clojurescript (60)
- # core-async (14)
- # css (11)
- # datomic (9)
- # devcards (9)
- # dirac (2)
- # editors (13)
- # emacs (5)
- # euroclojure (1)
- # events (3)
- # hoplon (76)
- # immutant (10)
- # job (1)
- # jobs (2)
- # keechma (1)
- # ldnclj (33)
- # lein-figwheel (1)
- # leiningen (20)
- # luminus (26)
- # mount (31)
- # om (105)
- # onyx (56)
- # parinfer (29)
- # perun (12)
- # proton (1)
- # re-frame (14)
- # reagent (5)
- # sydney (1)
- # yada (15)
A talk (partly) about re-frame at the react conf: http://conf.reactjs.com/schedule.html
Nice! Will watch
Hey guys, I have a weird bug, I'm under the impression re-frame/reagent does not update the ui for a component parameter change:
(defn base [id]
(let [show-db-summary (subscribe :show-db-summary?)]
(fn []
[:div#main {:className "sidebar-l sidebar-o side-scroll header-navbar-fixed"}
[side-overlay]
[sidebar]
[header]
(if @show-db-summary
[db-summary]
(case id
:a [a/main]
:b [b/main]
(do (log/error "Unknown module:" id)
(dispatch :navigate :404))))
[footer]])))
(defn main []
(let [module (subscribe :active-module)]
(fn []
(cond
(= @module :welcome) [welcome/main]
(contains? #{:a :b} @module) [base @module]
:else [module-404]))))
the rest of the system works fine, I display the :active-module
in the header, it's updated correctly
@lsenta: I didn't see all the details, perhaps there's something else missing, but one thing is that you need to put id
in the args list of the inner fn in your base
component. So it would be:
(defn base [id]
(let [show-db-summary ...]
(fn [id]
...)))
See the rookie mistake
section at the end of https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components#form-2--a-function-returning-a-function 😄
@lsenta: nberger has identified the bug, but that codes is not very re-frame-y
the way that it does an imperative (dispatch :navigate :404)
That is an attempt to change the state of the app. That decision should be in an event handler.
Views just render the current state
(and dispatch in response to external events) They don't make "decisions about state changes"