Fork me on GitHub

Hello! I’m looking the electric-starter-app. I have one question. The requires “ring.middleware.cookies”. But in the, it seems that no “ring.middleware” related deps like “ring/ring-core” are declared. How does this code get “ring.middleware” related deps?


the middleware namespaces are part of ring.core, which comes in as a transitive dependency from info.sunng/ring-jetty9-adapter


@U09FL65DK Thank you for reply! I’m confused. I’ve been thinking that directly using transitive dependencies of declared dependencies is not allowed in clojure. Is it wrong?


you can require anything that is on the classpath

Hans Moser14:04:13

Hi all! I love playing with Electric, this is really cool stuff but I ran into some problems with form elements while modifying the starter app. 1. Is there an easy way to access the value (and possibly name) of a radio input? I naively tried the following, but the whole click event is passed to (e/fn[v]...).

(dom/form (dom/text "1%")
  (dom/input (dom/props {:type "radio" :name "r1" :value "1"})
  (dom/on "click" (e/fn [v] (reset! !ss (x->y v)))))
(dom/text "5%")
  (dom/input (dom/props {:type "radio" :name "r1" :value "5"})
  (dom/on "click" (e/fn [v] (reset! !ss (x->y v))))))
2. Using the same idea with checkboxes, they pass true or false to (e/fn) which usually makes sense. I'm wondering if there is a way to change the values though, e.g. through the props (dom/props {:id "cb1", :value "1"}) which doesn't seem to work.

Dustin Getz16:04:26

controls in the dom namespace (i.e. dom/input) pass dom events to the callback for max low level dom power

Dustin Getz16:04:57

controls in the ui namespace (i.e. ui/checkbox) get the value, these controls are intended to be higher level

Dustin Getz16:04:50

We haven't provided ui/radio yet,

Dustin Getz16:04:00

I believe we are questioning if ui/radio is really just a styled picklist, similarly sets of checkboxes may also be picklists (as opposed to a single bool field on a record)

Dustin Getz16:04:43

picklists are pretty complicated, for example the khan academy course picker is showing a single page of results with overflow ("see all" button) so there is in fact server pagination happening on this simple checkbox picker, should a radio picker also have this functionality? considering a radio picker is just the single-select version of a checkbox picker which is multi-select?

Dustin Getz16:04:21

We have strong opinions on all of this and have built all of these widgets before, we just haven't yet gotten around to redoing them in Electric

Dustin Getz16:04:16

In the meantime you could implement your own radio control using the dom namespace if you want a higher level interface than the event

Dustin Getz16:04:59

We also have comprehensive crud form functionality which has not yet been revealed/documented, it supports optimistic updates and handles robust server sync, this is under active development as electric-ui5, hope to release the next version of this in May

Hans Moser19:04:31

Thanks a lot for your detailed reply, Dustin. I will give it a shot but it is great to know that an official form implementation is on its way. I still have a hard time wrapping my head around how it all ties together at this point.