Hi! i was wondering if anyone had tips on using the leiningen re-frame template with doom emacs?
Ah, thank you! I’ve got piggyback added, but still not working 😕 . I’ll move this to the emacs channel though!
Basically my confusion is around what i should expect. I have some experience with a clojure app made with compojure, and apps built with bb. In both cases, when I connect to the repl from emacs, I can evaluate code in the buffer and see the results inline, e.g (+ 1 2 3 4) => 10
I’ve made a new re-frame app with lein new re-frame
, and started it by running lein deps
and lein watch
I can connect to browser repl by running cider connect cljs
and choosing localhost:8777. I can then, in the repl , run commands like (js/alert "hi")
and see that alert box in my browser.
however, if i write new code and do ,ee
to evaluate, nothing happens. I am unclear if this means that I have the project set up incorrectly, or if I am misunderstanding how that repl connection works. should i be able to evaluate sexp’s in my namespace, and not just the cljs.user
namespace? thank, you!
I think it belongs to the emacs Channel, but did you check if you had cider-piggyback in your deps?
Goodmorning all! I'm looking for a way to redefine app-db for a subtree of components. Practical use-case: I want to visualize different variations of the same component that uses subscriptions side-by-side using devcards. Before anyone suggest a best-practice to avoid this: The stateful behaviour is too complex (multiple subscriptions on multiple levels of nesting) to split up into a dumb component to put in devcards and control with a connected component in the actual app. Otherwise I would definitively do that (and am in fact doing that for most other components)
I tried with with-redefs
inside my devcard which didn't work. Probably because the card itself isn't the function doing the actual "rendering", so I guess the with-redefs is either coming in too early or too late to actually have an effect on the child components of the card
I think using <iframe>
with completely different apps would be the best and the simplest.
see https://github.com/day8/re-frame/issues/137 for a long explanation
Thanks for those pointers! I'll have a read of that issue thread and see where that leads me. Iframes seems a bit cumbersome to me, since that means I would have to make extra stub apps which contain only the component that I want to test. Seems like a lot of boilerplate for what I'm trying to do?
Hmm, seeing the debate on that github thread and how A) there's no clear solution to this yet(!) and B) a lot of ideas around a solution seem to involve leveraging react context... I think I'll go with using context myself for this usecase. I'm lucky that the "subscribing" logic in my case is isolated in one component for now which is just repeated on multiple nesting-levels. So I'll replace that component with one that instead of doing a subscribe, gets its value from context and then wrap the higher-level component in a context provider which will get its value from the former subscription. (Sort-of) Again thanks for the pointers!!
Is anyone actively working on re-frame's EPs?
Yes we are regularly re-visiting these, esp we have a pretty good plan re • https://github.com/day8/re-frame/blob/master/docs/EPs/002-ReframeInstances.md • https://github.com/day8/re-frame/blob/master/docs/EPs/003-ReusableComponents.md Any contributions or discussion is absolutely welcome 🙂 I recently enabled 'GitHub Discussions' for re-frame which may be a good forum discussing EPs ? https://github.com/day8/re-frame/discussions
(defn frame []
{:app-db (ratom {})
:kind->id->handler (atom {})
:event-queue (->EventQueue :idle empty-queue {})})
Anything else stateful in re-frame?