Clojurians
#om
<
2016-10-18
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

ag00:10:44

remember? you can grab the parser from keys

(defmethod readf :foo
  [{:keys [state query ast parser]} k params] ....)

ag00:10:47

nevermind… I found it

tony.kay04:10:52

Anyone see a problem with follow-on reads breaking rendering when both parent and child query the same-named property? I’ve got a parent-child that both query the same prop name, and if I include it as a follow-on read when adding a new child things blow up (no queries found for component at path).

snoonan06:10:11

(om.next) Is there any good way to render one reconciler inside another? I have a timetravel/log/undo reconciler because I want om goodness in my undo tree, but I also want to render it under the top level html tag of the actual page.

dzannotti12:10:03

what's the best way to do chained mutations? I have a validate (remote) mutation and a save (remote) mutation, i would like to create a validate-and-save mutation out of composing those 2 (with save being executed after validate is finished and returned from remote)

ag18:10:00

hey guys… for some reason when I return {:remove ast} it wouldn’t propagate to the send. Anyone has any clue why could that be? @anmonteiro maybe some compassus magic I don’t know about?

anmonteiro18:10:08

@ag let me guess :slightly_smiling_face:

anmonteiro18:10:12

you’re doing recursive parsing

ag18:10:53

sorta…

anmonteiro18:10:05

i.e. calling the parser from the parser

anmonteiro18:10:28

the thing is that :remote needs to be returned at the top-level, just like a regular recursive function call

anmonteiro18:10:48

@ag also, when it clicks for you why that is the case, would you mind adding an entry to the Om Next FAQ? https://github.com/omcljs/om/wiki/Om-Next-FAQ

anmonteiro18:10:21

I think I’ve been answering this question every week for a long time, so I would have somewhere to direct people :slightly_smiling_face:

ag18:10:46

“if... it clicks”. Using Om.Next I feel enlightened. But most of the time I feel stupid

anmonteiro18:10:13

@ag I love feeling stupid, and I think it’s something everyone should strive for :slightly_smiling_face:

anmonteiro18:10:22

just means you’re in the process of learning

dzannotti18:10:37

@anmonteiro hate to ask directly, any suggestions for my question earlier?

anmonteiro18:10:56

@dzannotti I didn’t read it

anmonteiro18:10:59

let me scroll up

anmonteiro19:10:54

@dzannotti can’t you do both in 1 roundtrip?

dzannotti19:10:06

@anmonteiro i could, but i still need validate separately (because it can be called manually) and i would end up duplicating the validation code this way

anmonteiro19:10:33

@dzannotti no I mean: (om/transact! [(validate!) (save!)])

anmonteiro19:10:47

if both are :remote they’ll be batched

anmonteiro19:10:04

and you still can use validate! separately in other contexts

dzannotti19:10:08

uhm... yeah i could, but i'd rather the component not be aware of the logic behind it (and just call validate-and-save), also the batching assumes that the save mutation can't rely on the result of validate (which in this case is fine)

ag19:10:48

@anmonteiro still something not right. I have a component that set-route! that delegates to another component, that has a query. for its dispatch I return {:remote ast} and it’s not even trying to send anything to the back-end :disappointed:

anmonteiro19:10:35

@ag happy to look at a minimal case, but there’s just not enough information for me to understand what might be going on

ag19:10:37

right… do you remember that sample project you have showed me how to use compassus the first time? Now, I am serving things for the index page from the back-end. and that works. Now in that component in on-click I do e.g.: c/set-route! this :foo and :foo in core.cljs said to use Foo component. Foo component has a query, parser dispatching correctly on the correct key, but I cannot make it fetch data from the back-end :disappointed: returning {:remote ast} or {remote true} or whatever not forcing the fetch

molstt20:10:58

is it possible to cut a way the root from the ast tree in a read function (replacing the ast in the env)? when routing (via union query) I was partially successful doing so, but subsequent queries unexpectedly also looks truncated. May I have destroyed some state tampering with the ast?

ag21:10:53

@anmonteiro is it possible it’s a bug in compassus? It looks like I’m trying extremely trivial case - it fetches data from remote for index-route, but for whatever route after that it refuses to even propagate to send func. Is there a trick I have to use? I tried :query-root true - still nothing

anmonteiro21:10:32

@ag could definitely be a bug in Compassus. A minimal repro would really help

anmonteiro21:10:48

it’d be awesome to get that in for the nearing 0.3.0 release

anmonteiro21:10:55

if we confirm it’s indeed a bug

ag21:10:14

alright… gimme a minute… I’ll cleanup things and push it out.. I’ll ping you

ag21:10:18

thanks!

ag21:10:58

https://github.com/agzam/trying-compassus so here… initial route fetches data. you click on an item… and it doesn’t :disappointed:

ag22:10:59

@anmonteiro so in the second defmethod target is nil.. is that right? Compare it with the first defmethod (the one that does fetch data) first time target is nil, on the second pass it’s not nil