Fork me on GitHub
#re-frame
<
2021-09-06
>
Franklin07:09:15

hello 👋 , how can I stream json lists into the app-db using http-xhrio?

Franklin07:09:53

I've seen this kind of thing done with http://oboejs.com/

Franklin07:09:42

I wonder if there's a build in way of doing it with http-xhrio or will I need to custom build something?

zendevil.eth09:09:18

I’m encountering a very basic issue during app development that arose spontaneously.

zendevil.eth09:09:10

I dispatch an event from my views file:

(rf/dispatch [:some-event "foo"]))
Here’s the event:
(reg-event-db 
  :some-event
  (fn [db [_ param]]
    (prn "this is the param" param)
    (assoc db :param param)))
this event is supposed to be triggered on pageload, but when I hard reload the webpage, I get the following:
re-frame: no :event handler registered for: {ns: null, name: 'some-event', fqn: 'some-event', _hash: 908360591, cljs$lang$protocol_mask$partition0$: 2153775105, …}
How do I fix this?

p-himik09:09:01

Where do you call dispatch?

zendevil.eth10:09:05

(defn navigate! [match _]
 (prn "match is " match)
 (rf/dispatch [:some-event "foo"]))
(defn start-router! []
  (rfe/start!
   router
   navigate!
   {:use-fragment false}))
(defn init! []
  (start-router!)
  (ajax/load-interceptors!)
  (mount-components))
These are all in my core.cljs that contains the views

p-himik10:09:37

I don't know what rfe/start! is and where init! is called. But there are two possible causes: • You never load the namespace with (reg-event-db :some-event ...) • You do load it, but after that dispatch is called You gotta register all the relevant events first - only then you can use them. Just like with functions - you can't call (f) if the line with (defn f []) hasn't been executed yet.

zendevil.eth10:09:34

I’m most certainly requiring the events namespace in core.cljs

p-himik10:09:17

I will be able to provide more help if you create a repo with a minimal reproducible example.