# om

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

mclarke 22:12:52

is there a pattern in om next for combining a remote mutation and a remote read as part of the same query expression?

mclarke 22:16:06

e.g. if you call (om/transact! this ‘[(create-object) :list/objects]) on the client, is it sane to send the mutation and receive the full list of objects back in the response, including the newly-created object?

anmonteiro 22:18:39

@mclarke: that’s how I’d do it. are you having any problems with that approach?

anmonteiro 22:18:55

after all doing all of that in a single batched request is one of the reasons Om Next exists :slightly_smiling_face:

mclarke 22:19:16

yeah that was my understanding as well haha

mclarke 22:19:30

i think i’m doing something wrong on the client then, since the full query isn’t being sent, just the mutation

mclarke 22:28:02

the component i’m calling transact! from has a query [{:apps/items (om/get-query Application)}], should the read argument to transact! be just a keyword or can it be the full “fat” query

mclarke 22:29:10

i thought i remembered reading om performs a lookup based on the keyword to generate the query for you, but that could be mistaken

mclarke 22:30:07

transform-reads is what i was thinking of

anmonteiro 22:33:10

@mclarke: yeah, just the keyword is enough. but I don’t think follow-on reads perform remote reads

mclarke 22:34:28

i see - i was playing with (om/force) as a way to trigger the second read, but didn’t have success with that either

mclarke 22:37:08

is a follow-on read in transact! different from the combined “mutate & read” query that i’m trying to send to the remote?

mclarke 22:40:05

e.g. maybe i should refactor to call (om/transact! this ‘[(create-object)]) and in the client-side mutate function somehow rewrite the query that is sent server-side from [(create-object)] to [(create-object) {:list/objects [...]}] or something similar

anmonteiro 22:40:51

@mclarke: I think force should work

anmonteiro 22:42:06

actually the parser doesn’t seem to recognize it, I’ll have to look with more time

mclarke 22:43:21

ah got it. if it did recognize force, i think it would trigger a second network call to re-read the data after the mutate is sent server-side, correct?

mclarke 22:44:25

(appreciate the help on this sunday, i’ve been banging my head against this for a while now :P)

anmonteiro 22:47:21

@mclarke: I’m unsure if it would trigger a 2nd network call or batch both queries

mclarke 22:49:44

got it - i could see how either behavior might be preferred in different situations

anmonteiro 22:51:36

@dnolen: in case you’re thinking about cutting a release with the recent fixes, I’d still like to get a fix in for #727 before that if you don’t mind

dnolen 22:51:48

@anmonteiro: ok, will wait for that