Fork me on GitHub
#om
<
2017-07-26
>
danielstockton11:07:26

I'm returning an ast from one of my parsers (associng some params). Does anyone know why the first read is sent with params but when I (om/transact! this [:the/read]) it only sends :the/read to the backend (params missing)?

danielstockton09:07:33

@U0CK4CKAP I think this might be a bug in compassus. The om.next parser is called twice and the second time it has a different read function. This read doesn't go through my parser and returns a different ast to the one i'm returning.

danielstockton09:07:51

The second read adds a :query key to the ast which has the correct query with params, but the params are not present in the top level of the ast.

anmonteiro16:07:40

please open a ticket with a minimal example

danielstockton09:08:09

The cause seems to be transacting on a component which doesn't have a query.

danielstockton09:08:23

If I move the transact into the Index component, it works perfectly.

danielstockton09:08:04

Actually, i'll try removing compassus too, because im not sure if it's a compassus or om problem.

danielstockton09:08:46

Yes, it's definitely a bug in compassus/parser and I have a simpler repro.

danielstockton09:08:48

Another repro, showing transact in parent working but not in child: https://gist.github.com/danielstockton/5037d2063b16e81cd067b78d7fff4de0 It all seems to work fine in om.next and in the previous repro which was just using a compassus parser but not compassus/app, it didnt work in either parent or child.

danielstockton11:07:57

I've added a print to my parser and it returns the exact same ast in both cases.

joelgluth11:07:55

happy to see @bensu here, as one of the answers to my question might be “understand doo”. In general, I want to do some testing of the rendered output of my Om components. Part of my problem is almost certainly that I don’t understand React’s behind-the-scenes behaviour. If I call om.dom/div from within my cljs test in doo just to see what happens (I’m not expecting anything to render here, I just want to see what comes back), doo times out and dies, I assume because some runtime thing is missing - so I guess I need to figure out how to call my Om component functions from the right kind of running React context. Then, next, figure out how to render them individually. Is anyone using cljs.test to do testing of rendered output?

joelgluth11:07:13

(I realise the meta-mistake here is “attempt to learn React by learning Om instead of before learning Om”, but I’m here now.)

bnvinay9213:07:28

Do I need to go through om tutorials before going through om-next tutorials?

sundarj14:07:03

no, you do not - they're distinct

bensu18:07:00

Hi @joelgluth, I haven’t worked on that library on a while so the bindings to React.test might be old

bensu18:07:46

but your question is more about the procedure on how to test the render function of components and the examples in that project should show you the structure. Ping me if you have any questions

joelgluth19:07:27

Yup. Got it working with your versions this afternoon, thank you for showing the way forward! I'll have a look at how far it's drifted from current Om tonight; might be one of those "only still working by accident" situations ;)