om

Please ask the channel first, not @dnolen directly!
2017-03-21T11:05:14.430370Z

I have the following component hierarchy: Wrapper -> Header -> Nav -> [Dropdown1, Dropdown2, Dropdown3] Dropdown1, Dropdown2, Dropdown3 can change based on route (effectively I want a secondary routing system alongside compassus for main routing). I want to be able to add root queries to Dropdown1, Dropdown2...How would you do this?

jannis 2017-03-21T11:13:04.528110Z

Global links? {[:foo _] <subquery>}

2017-03-21T11:16:38.571342Z

@jannis What would the query look like in Wrapper, Header, Nav? I was thinking it would involve some recursive parsing like in https://awkay.github.io/om-tutorial/#!/om_tutorial.E_State_Reads_and_Parsing

2017-03-21T11:17:37.583209Z

Do you always need to hike the child query into the parent or can you have a query with a link just floating in space?

jannis 2017-03-21T11:18:01.588336Z

Ah, no, I’m almost sure you can’t.

jannis 2017-03-21T11:19:10.601763Z

What I’m doing these days is recursive parsing with a single read entry point, using my own query engine and data store. You can lose some of Om Next’s features that way though.

2017-03-21T11:21:13.625971Z

I think it will work with something like this:

(defmethod read :header
  [{:keys [query parser] :as env} _ _]
  {:value (parser env query)})

(defmethod read :nav
  [{:keys [query parser] :as env} _ _]
  {:value (parser env query)})
for all the intermediary components..

2017-03-21T11:21:32.630181Z

It just nests it under the key and delegates the query to the next level.

jannis 2017-03-21T11:21:43.632477Z

That by itself doesn’t solve the problem but I never liked the idea to use join keys that are tied to the UI just to pull in sub-component queries. So I decided to never do that and always only join on actual data / entities.

2017-03-21T11:22:43.644698Z

Yeah, I don't like it either but I can't see another way other than inventing my own query engine, as you say...

2017-03-21T12:00:19.093355Z

I wrote

(defmethod read :delegate/nav
  [{:keys [query parser] :as env} _ _]
  {:value (parser env query)})
and I just use this key in all components that I want to just pass props through... Not sure if this is a good idea or not but it works.

rgm 2017-03-21T17:45:43.596163Z

hi all, super newb here... can anyone give me pointers to any overviews on why I'd pick either om.dom or sablono? I presume there's a reason they both exist, and I'm guessing there's some extra stuff that om.dom is doing.

anmonteiro 2017-03-21T17:46:46.620421Z

@rgm choose what you prefer. the only thing to be aware of is that sablono won’t support server-side rendering if you eventually want to go through that path

rgm 2017-03-21T17:47:09.629211Z

ah, ok. That is a good thing to know, thx.

rgm 2017-03-21T17:48:34.662651Z

seems like they mix/match/compose, so if I were feeling particularly hostile to future-me I could om.dom only the parts that I currently guess would benefit from SSR.

rgm 2017-03-21T17:50:29.706973Z

seems to be pre-om.next but I guess this'd be another pro of om.dom ... http://swannodette.github.io/2014/02/27/taking-off-the-blindfold

petterik 2017-03-21T18:43:48.923655Z

Changing file extensions from .cljs to .cljc and seeing my UI loading instantly with SSR was extremely satisfying

baptiste-from-paris 2017-03-21T20:18:51.906186Z

hello guys, any recommandation for validation in forms ? I am not talking about the validator key in factory which assert props (and then throw an error if it goes wrong). I am more talking of a strategy to validate user’s input

baptiste-from-paris 2017-03-21T20:18:59.908725Z

Do you use simple components ?

sineer 2017-03-21T21:40:53.476692Z

@baptiste-from-paris use Spec.