This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-06
Channels
- # babashka (31)
- # beginners (108)
- # calva (6)
- # clj-kondo (62)
- # cljsrn (5)
- # clojure (29)
- # clojure-australia (2)
- # clojure-europe (17)
- # clojure-nl (2)
- # clojure-spec (5)
- # clojure-uk (7)
- # clojurescript (25)
- # code-reviews (1)
- # datomic (13)
- # deps-new (7)
- # editors (1)
- # emacs (31)
- # figwheel-main (3)
- # garden (4)
- # graalvm (18)
- # helix (10)
- # improve-getting-started (12)
- # jobs (3)
- # lsp (20)
- # malli (12)
- # off-topic (7)
- # polylith (30)
- # re-frame (10)
- # remote-jobs (2)
- # shadow-cljs (18)
- # spacemacs (5)
- # sql (11)
- # tools-deps (10)
- # vim (9)
- # xtdb (1)
I've seen this kind of thing done with http://oboejs.com/
I wonder if there's a build in way of doing it with http-xhrio
or will I need to custom build something?
I’m encountering a very basic issue during app development that arose spontaneously.
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?(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 viewsI 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.
I’m most certainly requiring the events namespace in core.cljs