Fork me on GitHub
#re-frame
<
2017-02-17
>
glebkaf08:02:09

Hi there! How can I prevent the execution of event-handler from within interceptor? I tried to filter (:queue context) by :db-handler, but it doesn't work, because for some reason I can't iterate over queue. Following code doesn't print anything:

(map #(prn %)  (:queue context))
If I just assoc empty vector to :queue it works, but I want to remove particular interceptor from chain 🙂

mikethompson09:02:19

The theory is that you can make changes to the queue. In practice not many have, so you are in slightly uncharted territory

glebkaf09:02:58

mikethompson: thanks for advice, I'm just experiment 🙂

mikethompson09:02:44

For clarity: it was absolutely designed that way, so you are absolutely doing the sort of thing it was designed to handle. I'm just worried that not all the parts are exposed that should be exposed to make your life easy.

emilyseibert13:02:13

Any tips for handling form errors from an API with re-frame? I’m passing error callbacks to the REST request but was wondering if there was a better way

mccraigmccraig13:02:11

@emilyseibert dispatch from a callback - i have a wrapper for the ajax fn which lets you supply template success and failure dispatch vectors, which will have the success/failure values appended to them before being dispatched

hjrnunes15:02:21

Hi all, how does one use subscription paths with the 0.8 reg-sub?

hjrnunes15:02:50

Might be me but all I can find is the db-only and input signal ones.

hjrnunes15:02:37

Does reg-sub-raw have to be used for this?

hjrnunes15:02:54

to clarify, how does one do this with reg-sub?

(register-sub
  :data
  (fn [db [_ field]]
    (reaction (get-in @db [:data field]))))

glebkaf16:02:30

I'm using it this way:

(reg-sub
 :data
 (fn [db [_ field}]
   (get-in db [:data field])))

isak15:02:33

@hjrnunes i've done it like this, so you don't dereference the whole app-db

(rf/reg-sub-raw
   k
   (fn [db _]
     (reaction
      @(ra/cursor db path))))

hjrnunes15:02:06

isak: yeah, that makes sense. I was just wondering how to do it with the new reg-sub, if it's at all possible

hjrnunes15:02:16

Because I can't find any examples for it

isak15:02:58

not sure, but i'm still learning the framework

hjrnunes15:02:46

Yeah no worries. Keep up with it, it's great stuff!

scknkkrer18:02:52

@kasuko, bro. Are you here ?

kasuko19:02:50

I am now, whats up?

timgilbert20:02:51

One of my co-workers has proposed naming :<- the "grumpy bird operator"

scknkkrer20:02:18

@kasuko, bro I have to implement a template with hiccup. I translate via one web page html to hiccup. but I don’t have much any experience on designing UI. It’s like a hell. I don’t even get page schema on elements. Is there a way or tool to boost me up ?

timgilbert21:02:23

Say all, what's the preferred method of producing a subscription takes the result of a different subscription as an input parameter? I was mildly surprised to see that this works, it seems a little dirty to me:

(reg-sub
  :product/for-slug
  (fn [_ _]
    (subscribe [:product/for-slug @(subscribe [:current-route/slug])]))
  (fn [product]
    product))

timgilbert21:02:47

I see I can also use (reg-sub-raw) but it looks about the same:

(reg-sub-raw
  :product/for-url-slug
  (fn [_ _]
    (reagent/reaction
      @(subscribe [:product/for-slug @(subscribe [:current-route/slug])]))))