This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-17
Channels
- # announcements (4)
- # beginners (82)
- # boot (1)
- # calva (26)
- # cider (13)
- # clj-kondo (41)
- # cljs-dev (25)
- # cljsrn (7)
- # clojure (82)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-dev (13)
- # clojure-europe (11)
- # clojure-italy (27)
- # clojure-nl (8)
- # clojure-russia (6)
- # clojure-spec (32)
- # clojure-uk (15)
- # clojurescript (61)
- # core-async (1)
- # cursive (9)
- # data-science (1)
- # datomic (18)
- # duct (1)
- # emacs (2)
- # events (7)
- # fulcro (13)
- # graalvm (5)
- # immutant (1)
- # jobs-discuss (63)
- # leiningen (3)
- # off-topic (48)
- # om (3)
- # pathom (13)
- # planck (20)
- # prelude (3)
- # re-frame (55)
- # reagent (13)
- # reitit (5)
- # rewrite-clj (12)
- # shadow-cljs (67)
- # spacemacs (14)
- # sql (5)
- # tools-deps (4)
- # vim (23)
- # yada (2)
@kingcode I am a little biased, but https://github.com/gadfly361/rid3
I'm a fair way along developing a decent size React Native application using Re-Frame. Broadly happy with the framework (it's certainly nicer than other things I've used in the past)
I feel like I'm starting to find a few pain points now and would be interested to discuss them with people in here who may have advice / similar war stories 🙂
@kingcode depending on your needs, you might also want to look at using vega-lite
Instead of using d3 directly
This will be of use: https://github.com/metasoarous/oz
@attentive if you can describe the problems in the most minimal/distilled way you might well get some good feedback.
Thanks @mikethompson - was considering vega already, didn’t know about oz, will definitely check it out!
You might know this already but there is vega and vega-lite. The second is much easier to use and yet more than powerful enough for most circumstances
There is also highcharts which some seem to like
@ mikethomson I need to create a graph for multivariate clustering - sort of plotting dots (data points) in a 2d space with no axis, but the distance b/w dots should be proportional to their respective distances from one another (which I would provide from a distance fn). Also, pretty neat that Vega/lite is built on top of d3.js - I was reading up on that. Thx for your advice.
Any idea why I would be getting a re-frame: no :event handler registered for:
when I am requiring app.events in core.cljs? This only happens upon start of the app so I expect some kind of race, but not sure how to ensure that handlers are registered before being called other that through require in core.cljs.
@mac the error comes from here: https://github.com/Day8/re-frame/blob/69a3fcd411369fff65404e7d6a924ce1968e2dba/src/re_frame/registrar.cljc#L31
So the id
of the event appears to be blank??
Are you doing this (dispatch [])
?
@mikethompson Oh, sorry the full text is app.events/add-event-to-log
.
@mikethompson I mean the error does contain the id.
@mikethompson Full text is re-frame: no :event handler registered for: :app.events/add-event-to-log
So, you feel that you are dispatching that event before registering.
@mikethompson That is how it appears to me, but since I require events in core.cljs, that should not really be possible right?
@mikethompson Is there a way to list all registered handlers?
No official API, but re-frame.registrar.kind->id->handler
is a map ...
which has a key :event
Who's value is another map which links ids
with handlers
So ... this will give you all registered event handlers (keys (:event re-frame.registrar.kind->id->handler))
@mikethompson Yeah, so the handler is there.
@mikethompson Ah, no it is not. Not upon reload. But if I change the calling namespace and trigger a recompile it is there. So it appears it is a race of some sort.
@mikethompson In fact :event is nil. So no handlers are there.
I'd put a breakpoint in dispatch to find out where this early dispatch is happening
So put a breakpoint in about here: https://github.com/Day8/re-frame/blob/69a3fcd411369fff65404e7d6a924ce1968e2dba/src/re_frame/router.cljc#L245
Then, at least, you can figure out what is dispatching so early in your startup
@mikethompson Sorry for my ignorance but how do I go about setting a breakpoint in that file?
When running the application in the browser: 1. press F12 to get devtools up 2. Click on the "Sources" tab 3. Find the cljs file I nominated. 4. Put in a breakpoint 5. Reload you application
(I'm assuming are doing dev builds and you have source maps)
@mikethompson Got it. It is called from my init-db function.
So your init-db
function should get called by your main
Because by the time you get to executing main, everything is loaded
And all events should be registered
@mikethompson main
? I have an init
in my core.cljs
Okay, then that
Whatever is your entry point
@mikethompson I am dispatching my initialize-db
event from init
in core.cljs
.
Code is in a library, so adding (js-debugger)
is harder
@mikethompson But that does not hit the breakpoint, I think because it uses dispatch-sync.
Right.
So you'll have to set an extra breakpoint
I'm afraid I'm off to bed.
@mikethompson Thanks for your help, really appreciated.
@mikethompson Solved it. There was a def
that - indirectly - invoked dispatch
in app.db
which in turn was being required by core.cljs
.