This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-28
Channels
- # aatree (1)
- # admin-announcements (5)
- # beginners (5)
- # braid-chat (2)
- # cbus (2)
- # cljs-dev (8)
- # cljsrn (13)
- # clojure (101)
- # clojure-chicago (1)
- # clojure-greece (11)
- # clojure-russia (77)
- # clojure-taiwan (1)
- # clojure-uk (5)
- # clojurescript (73)
- # core-async (5)
- # core-matrix (1)
- # cursive (5)
- # datomic (10)
- # devcards (44)
- # emacs (16)
- # hoplon (207)
- # keechma (5)
- # lein-figwheel (1)
- # leiningen (5)
- # liberator (3)
- # melbourne (1)
- # om (171)
- # onyx (25)
- # parinfer (1)
- # proton (2)
- # re-frame (28)
- # reagent (50)
- # untangled (7)
- # yada (4)
@hoopes @afhammad an alternative to manually namespacing keys would be to use a double colon, e.g. ::foo
Say youre in a namespace app.panel1 and you make a key ::foo
in that namespace. If you require that namespace somewhere else, you can alias it like [app.panel1 :as panel1] ... then you can access that foo key by doing :panel1/foo
Its a way to use actual namespaces as opposed to mocking them with keynames by convention
got it - had to learn what the double colons are for real quick even better than the slash, thanks a lot!
@gadfly361: Interesting, thanks
Hello, I've a problem and I don't know how to solve. What is the correct way of doing this
(defn servicio-tiempo [servicio] (reagent/with-let [gruas (subscribe [:servicio->gruas servicio]) rutas (subscribe [:servicio->rutas servicio]) servicios [servicio]] [:div [map-component {:gruas @gruas :rutas @rutas :servicios servicios :autofit true :style {:height "450px"}}] ] ))
I'm using a subscription, but I'm passing a parameter to it. This is not making the component to change when the parameter servicio is changed
Evaluating the value every time the component is rendered obviously works correctly
But, I wanted the subscription to be reactive. Is that possible? Or I'm doing just wrong?
@josesanch: is servicio
an atom/ratom?
if so then I don’t believe it will trigger a re-render when its value changes (unless you deref it) since it will be compared using identical?
rather than =
. You can read more about that here: https://github.com/Day8/re-frame/wiki/When-do-components-update%3F#changed
@josesanch: if servicio
can change without component recreation, than you probably need dynamic subscriptions https://github.com/Day8/re-frame/wiki/Dynamic-Subscriptions
@escherize: Awesome advice, but as I've been trying to implement it I've been encountering a problem. Namely, when I try to have an input
with a value, and an on-change, I can't change the value anymore, ex:
[:input {:type "password"
:name "password"
:placeholder "Password"
:value @password
:on-change #(dispatch [:update-login-form
:password
(-> % .-target .-value)])}]
any idea wht I'm doing wrong?the dispatch works just fine, but the value isn't updating...
@josh.freckleton try with :default-value
instead of value
@nberger: hm, that mostly works! When I dissoc
though, the inputs don't update to being empty, which I think I'm subscribing to, any idea why not?
well, no subscriptions are working in these inputs?!
even though the ratom
changes, the changes don't propagate to :default-value @password
, but they do exist in the db...
Oh, that's the thing with default value though... It takes the value on mount, then doesn't update on external changes... You are dissocing in the handler?
The input in re-com handles the two kind of updates... Internal and external... You could use it, or see the code and use the same strategy
whew, just looked the code over here: https://github.com/Day8/re-com/blob/master/src/re_com/misc.cljs
a bit heavy for me, I'll try to avoid needing this for now, until I'm a better clj
guru
I may be thinking too hard about this one... Are there any examples for handling animations (e.g., toggling a class on a sibling element) when using re-com layout (v-box, h-box, box, etc)?
@tom I've had success using garden
https://github.com/noprompt/garden for toggling/tweaking css stuff. Have you considered that lib?