Fork me on GitHub
#re-frame
<
2020-12-14
>
zach01:12:52

Hi! i was wondering if anyone had tips on using the leiningen re-frame template with doom emacs?

zach02:12:11

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

zach02:12:41

I’ve made a new re-frame app with lein new re-frame , and started it by running lein deps and lein watch

zach02:12:36

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.

zach02:12:10

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!

David Pham03:12:27

I think it belongs to the emacs Channel, but did you check if you had cider-piggyback in your deps?

zach20:12:06

Ah, thank you! I’ve got piggyback added, but still not working 😕 . I’ll move this to the emacs channel though!

Adriaan Callaerts08:12:45

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)

Adriaan Callaerts08:12:11

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

p-himik08:12:24

I think using <iframe> with completely different apps would be the best and the simplest.

Adriaan Callaerts08:12:09

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?

Adriaan Callaerts08:12:58

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!!

👍 3
clyfe17:12:26

Is anyone actively working on re-frame's EPs?

superstructor18:12:17

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.mdhttps://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

👍 3
clyfe20:12:16

(defn frame []
  {:app-db            (ratom {})
   :kind->id->handler (atom {})
   :event-queue       (->EventQueue :idle empty-queue {})})
Anything else stateful in re-frame?