Fork me on GitHub

I am trying to use re-frame-debux with re-frame-10x. I spent a couple of hours getting it set up and playing with it but can't get re-frame-debux to work. I'm hoping someone will recognize the error messages and be able to tell me the obvious thing I've missed. We have been using re-frame for almost two years (love it) and I just circled back around to checking out re-frame-10x. I've checked the prereq's and versions - all good: clj 1.8 and cljs 1.9.946 I've got the dependencies set up with the two libs. tracing in :project/dev :dependencies and tracing-stubs in production :dependencies. cljsbuild :compiler settings

:preloads []
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true
                             "day8.re_frame.tracing.trace_enabled_QMARK_" true}
If I try to add [ :refer-macros [fn-traced defn-traced]] to my handlers.cljs file as :require and then use either of the macros, figwheel fails to compile with Could not Analyze ... Analysis Error targeted at the first use of the macro. If I instead add [ :refer [fn-traced defn-traced]] to in :require-macros, figwheel will compile the code, but I get a bunch of warnings and the app throws errors when I try to load it in the browser
WARNING: Use of undeclared Var at line 39 src/st/handlers.cljs
WARNING: No such namespace: debux.dbgn, could not locate debux/dbgn.cljs, debux/dbgn.cljc, or JavaScript source providing "debux.dbgn" at line 39 src/st/handlers.cljs
WARNING: Use of undeclared Var debux.dbgn/dbgn at line 39 src/st/handlers.cljs
Successfully compiled "target/cljsbuild/public/js/app.js" in 71.553 seconds.
Any idea what I'm doing wrong?


In case anyone runs into a similar problem to what I outlined above, after some digging it appears that any kind of frequent tracing or polling wreaks havoc on re-frame-10x and makes it unusable (I also tried and event based approach using :dispatch-later with similar results). Unfortunately the trace/event filtering in re-frame-10x appears broken. Using core.async helped side-step the tracing altogether.


is there an example for client-side routing with permission checks that i could follow? i've been trying to roll my own but i keep messing it up


the flow i'm trying to has login / remember me functionality with remote authentication, and when a user accesses some routes it should be checked whether they are logged in or not. at the moment i have a race condition between the remember me functionality and setting credentials in the router / permission checks. i've looked into async-flow-fx but it doesn't feel right


i'm getting warnings no handler registered for effect "event" in my console. what should i make of that?


Sounds like you might have a line of code somewhere that calls (re-frame.core/dispatch [event])?


oh, really? i thought i should be looking for {:event [...]} which i didn't find


Actually now that I look again (and have had a bit more coffee), that’s saying no handler registered for effect, so something is trying to get an effect handler for the value event


so maybe a reg-event-fx handler somewhere is returning {:db (some-db-value) event [:some-event]} instead of {:db (some-db-value) :dispatch [:some-event]}?


I can't get routing working, namely the ability to make figwheel dev server to serve routes from my re-frame app. I found this repo checked it out and it works as expected, you go to any route and it runs index.html which starts the SPA, however, it uses bidi & pushy, I use secretary & accountant, will it make difference/work if I switch to bidi & pushy? Or it is something else in my project.clj? I added :ring-handler and dev_server.clj as in the example project, do I have to add something else?


that's the magic, you have to force index.html for other requests


yeah, I have that in my app. Also, I'm using it with Spacemacs, maybe Cider messes up something?


and what specificly happens when you load a different route?


It returns with Figwheel Server: Resource not found


do you have an index.html file?


and you've configured the server to be your ring-handler


can you add another route like /test and see that it is working?


this doesn't work


if you mean :ring-handler option, then yes, it is :ring-handler


the static files are handled before the index


you will have to use a resource response


basically the handler in that example is forwarding a request for index.html


wait, let me try one thing, I think I messed up the path to dev-server


and that doesn't work


I don't think it will work


(ring.util.response/resource-response "index.html" {:root "public"})


I'm a bit lost here, should I use it in project.clj or in dev-server?


in your dev server you are forwarding a request for index.html


you actually want to *return* the index.html file


in fact you can ignore all the other stuff in that server and just return the index.html


as all static files have been resolved by the time your ring-handler gets invoked


🎉parrotit works! @bhauman thank you for help! So basically I just misspelled the namespace, stupid mistake, but the good thing, that this same approach works with secratary/accountant if any newcomers like me wonder if there is any difference


Now I wonder why I didn't get any error that namespace doesn't exist


what might be the best way to capture a re_frame db state before / after an error occurs? i was thinking an interceptor that just always maintains a ref to the current db - 1, and on error serialize both before/after db states. this also sounds like something that might already exist?


I have re-frame-10x working, but for the Event part. I've described trying to plug in the re-frame-debux to get the Event portion working. Is anyone using the Event tracing successfully?


@lwhorton I have been using console log stmts inside event handlers to introspect. That said, re-frame-10x does let you inspect the app-db in the browser and can show you the diff between two "Epochs" ie periods of events.

Vincent Cantin18:07:04

Is anybody here using datascript with re-frame? Via which library (I am currently reading the documentation of re-posh)? Is it a good experience as a dev or does it create problems?


About a year ago I wanted to use it in my project, but it turned out that datascript was about 10 times slower than using multiple get-in. In the end, I used a heavily modified version of subgraph.

Vincent Cantin17:08:27

10 times is huge! Did you happen to find out why it was so slow?


Not that huge if you make a small number of queries. 🙂 In my case, there was a decent amount, so using datascript would result in tens to hundreds of lost milliseconds. You should check issues on their GitHub page - there were discussions about performance issues.

👍 4

@vincent.cantin, ditto on the performance limitations with datascript, and also ended up building ontop of subgraph. The flexibility of having normalized data with pull semantics, but still having your db be an associative structure is huge.

👍 4
Vincent Cantin02:08:16

I did not know subgraph, will consider it. Thx!


@vincent.cantin i hesitate to use it. as awesome as it would be to have auto-normalized data in a datalog-backed query engine… sometimes its just too much effort to go against the flow


you’re now tracking a lib that has to follow re_frame, and who knows how quickly it scoops up new features. how does it work with all the extensions such as re-frame-10x, async-flow, undo, etc.? lots of things to figure out


so to answer you question, i don’t know. but those are the reasons i just stayed away. in the end update-in vs ? e where ?a in ?e didn’t seem worth it