Fork me on GitHub
#om-next
<
2017-02-02
>
raspasov06:02:58

@devth how does the component A query look like?

sova-soars-the-sora07:02:50

I have a component that reads the stuff from :user and now I'd like to also add all the items from another part of the atom data called :nf ... how would I do that? My original query is like '[:content :link :tag] and now I wish to do something like from the Thinking With Links! page where I Have [:nf _] so I can grab some attributes from the :nf vector, but it's really unclear how I can query out-of-scope things. I provide a ident? or a key in the map? puzzled

sova-soars-the-sora09:02:23

I just resorted to picking stuff out of the atom myself...

devth15:02:38

@raspasov it looks like [{[:ui/for-a-table _] [#:many.interface.app{:a [:db/id :a/name #:organization{:type [:db/doc]}]}]}]. turns out since that component is on another route in my app i didn't need to do anything to refresh. the reason it wasn't appearing to refresh was because when i ran a remote mutation and then a read, the read was using a database value before the mutation was applied!

Joe R. Smith16:02:58

@devth reads in the same transaction as a mutation need to have access to the new DB value, but you probably want to make the current DB value part of a request’s context (depending on what you’re using as a webserver this might be represented in different ways). I include an atom that contains the current DB value for the request and update it on mutations. I’d avoid grabbing a new DB value in each serverside read method, as you could read inconsistent data over the course of a request.

Joe R. Smith16:02:36

om.next will always call mutation methods before reads

devth16:02:43

i do make the current db available in the request's context

devth16:02:54

this is pre-mutation though, so it will be out of date by the time the read gets called

devth16:02:35

(this is the case where the request contains both a mutation and a read)

Joe R. Smith16:02:41

yup– so you might include a :db-ref keyval that is an atom in your context and reset! it to the :db-after in each mutation method

devth16:02:56

makes sense. thanks.

Joe R. Smith16:02:47

There are a lot of little things like this that aren’t spelled out in any documentation or tutorials.

sova-soars-the-sora22:02:50

With devcards & klipse I think om.next documentation can grow very quickly. There are still some big holes in what-does-what but i'm very optimistic 😃