This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-16
Channels
- # beginners (176)
- # boot (11)
- # cider (12)
- # cljs-dev (65)
- # cljsrn (54)
- # clojars (18)
- # clojure (195)
- # clojure-austin (1)
- # clojure-dev (2)
- # clojure-italy (8)
- # clojure-quebec (1)
- # clojure-russia (51)
- # clojure-serbia (3)
- # clojure-spec (24)
- # clojure-uk (28)
- # clojurescript (41)
- # cursive (14)
- # data-science (60)
- # datascript (2)
- # datomic (111)
- # emacs (6)
- # figwheel (1)
- # graphql (16)
- # hoplon (26)
- # juxt (2)
- # lein-figwheel (3)
- # lumo (12)
- # off-topic (8)
- # om (14)
- # pedestal (22)
- # perun (2)
- # proton (1)
- # re-frame (29)
- # reagent (27)
- # ring (17)
- # ring-swagger (2)
- # rum (3)
- # spacemacs (3)
- # unrepl (155)
- # untangled (28)
- # vim (4)
there shouldn't be problems mixing "display: table" and "display: flex" I think
@pesterhazy thanks, my initial experiments with using [:table ...]
seemed to work but i wasn't sure if i was storing up trouble
I have a question about "subscribing to external data" https://github.com/Day8/re-frame/blob/master/docs/Subscribing-To-External-Data.md Will the following approach work as the params change?
(defn recipe [props]
(let [{:keys [params]} props
{:keys [recipe-id]} params
recipe (subscribe [:graphql {:query "query recipe ($recipe_id:String!) { recipe (recipe_id:$recipe-id) { intro method }}"
:variables {:recipe-id recipe-id}}])]
(fn []
(let [{:keys [introduction method]} @recipe]
[rn/view
[rn/text introduction]
... ])))
(implementation not written yet, just not sure if I've understood what happens with the "subscribe to external data" as the params change - will the "subscribe" get the most recent props.and how does this fit in with the *-fx /handlers/keeping the side-effectful stuff pushed to the edge of the system
in a form-2 component @danieleneal your inner render fn needs to take the exact same params as the outer render fn - the outer fn gets called once on component creation, and the inner fn on every render - so the value of @recipe
will change and the props
passed to the inner fn will change, but if you want your recipe
subscription to change based on the updated props that will not happen - you have to create a new component or use a dynamic subscription
in re-frame >0.8 you can use subscribe in form-1 components though - see https://github.com/Day8/re-frame/issues/218
also useful reading - https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components and https://github.com/Day8/re-frame/wiki/Dynamic-Subscriptions
mm yeah, that makes sense.
So I can use subscribe directly in a form one component
something about that feels a bit strange
I'm still at the beginning of using re-frame, trying to get idiomatic usage
I enjoyed reading the stuff about effectful handlers,
I'm not sure I've completely 'got' how to do everything as cleanly with subscriptions yet
it takes some practice - did for me anyway 🙂
So if I flatten everything out like this .... it should just work
(defn recipe [props]
(let [{:keys [params]} props
{:keys [recipe-id]} params
recipe (subscribe [:graphql {:query "query recipe ($recipe_id:String!) { recipe (recipe_id:$recipe-id) { introduction method } }"
:variables {:recipe-id recipe-id}}])
{:keys [loading? response]} @recipe
{:keys [introduction]} response]
[rn/view
(if loading?
[rn/activity-indicator]
[rn/text introduction])]))
yes - you can do those destructures in one hit too with the longhand destructure syntax (i prefer it for deeper destructures) e.g. {{recipe-id :recipe-id} :params}
and {{introduction :introduction} :response loading? :loading?}
ah this looks interesting/close to what I had more in mind after reading the effectful handler stuff https://github.com/Day8/re-frame/issues/255#issuecomment-274303581
I’m writing my first re-frame app. I have multiple page views and separate each into it’s own NS with 3 files for each: events, subs, views, I’m guessing this is a common pattern. I find myself writing a lot of keywords that look like :search/run-search or :account/set-username I would love to write these with ::set-username but that would give me a keyword only in one of the sub namespaces, not one that can be shared amongst the 3. Is there a good workaround to make this possible. Would love a second level qualified keyword reader macro like #:run-search -> :app/search/run-search in the app.search.events NS.
Hello all, I want to make dialog library and reading about the Effectful Handlers, do you think it´s dangerous doing this?
(defn error [title message text-button fn-return-function]
(rf/dispatch
[:configurar-dialogo
{:titulo title
:tipo :normal
:mensagem message
:fn-confirmar fn-return-function
:texto-confirmar text-button}])
(rf/dispatch [:apresentar-dialogo :erro]))
The first one dispatch is to configure dialog informations and the second one is to render the dialog.
How to use it in the right way?I usually do this with one dispatch. I have an event handler that receives the name of the dialog and the configuration so it can do this all at once.
Hrmm... may have found a re-com bug. When adding a :tooltip
to a hyperlink
the hyperlink element gets indented
@owen yes you right .. but I dereference subs inside ios-swichery component. I update my slack post and add code of this component. I've tried also dereferenced before i pass to component but final effect is same
@borjarus I am wondering if you might need a :component-did-update function. You can see an example here - https://github.com/Day8/re-frame/blob/master/docs/Using-Stateful-JS-Components.md#example-using-google-maps