Fork me on GitHub
#re-frame
<
2021-07-20
>
Elias Elfarri12:07:09

re-frame: no :event handler registered for: fetch-data-handler

Elias Elfarri12:07:23

how do i use an event handler that i've moved to another folder?

Elias Elfarri12:07:40

it seems to not know that it exists

p-himik12:07:59

You have to require that new ns somewhere.

Elias Elfarri12:07:37

whats odd is that i require it and even use some other event handlers from it, but for some reason it is unable to recognize that one. The others work fine.

p-himik12:07:24

Can't really say anything without the code.

☝️ 2
Felipe Marques22:07:48

Hi, everyone, how are you doing? I was digging some aspects of re-frame and I found this post of lambda-island, saying that after v0.9.0 it is ok to do:

(defn toggle-all-checkbox []
  [:span
   [:input {:type "checkbox"
            :checked @(subscribe [:todos/all-complete?])}]
   [:label {:for "toggle-all"} "Mark all as complete"]])
And I was wondering if it would be ok to do something like this:
(defn toggle-all-checkbox [user-id]
  (let [todo-lists @(subscribe [:todos/list user-id])
        all-complete-list (mapv (fn [{:keys [id]}]
                                  {:id id
                                   :all-complete? @(subscribe [:todos/all-complete? id]}) 
                                todo-lists)]
      /* do something with it */    
))
Basically, I would like to know if it is ok to subscribe to something based on the results of another subscription. Does it make sense? Or am I missing something?