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)?
@anmonteiro 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.
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.
please open a ticket with a minimal example
Sure, will do.
I have a simple repro but I'm not sure if it's a bug: https://gist.github.com/danielstockton/e4687846f5e3df140fe192fd5fbe336d
The cause seems to be transacting on a component which doesn't have a query.
If I move the transact into the Index component, it works perfectly.
Actually, i'll try removing compassus too, because im not sure if it's a compassus or om problem.
Yes, it's definitely a bug in compassus/parser and I have a simpler repro.
https://gist.github.com/danielstockton/f52f87ac604d3523f10100b964b8b957
If you just change compassus/parser
to om/parser
it works.
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.
I've added a print to my parser and it returns the exact same ast in both cases.
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?
(I realise the meta-mistake here is “attempt to learn React by learning Om instead of before learning Om”, but I’m here now.)
Never mind - I found this https://github.com/bensu/cljs-react-test
Cheers @bensu 🙂
Do I need to go through om tutorials before going through om-next tutorials?
no, you do not - they're distinct
Hi @joelgluth, I haven’t worked on that library on a while so the bindings to React.test
might be old
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
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 ;)