Fork me on GitHub
#untangled
<
2016-10-10
>
ethangracer00:10:20

@tony.kay: will do, thanks!

wilkerlucio19:10:17

hello people, about the case when you want a partial query that isn't on any component and also need an ident with it. the docs for untangled recommend that we create a class just for the query. I'm have being toying with a different approach, in my case at least, most of my idents follow a common pattern, that is: [(:db/table props) (:db/id props)]

wilkerlucio19:10:23

so I created a helper like this:

wilkerlucio19:10:52

then I can just write: (untangled/load {:query [{:app/me ~(with-ident [:db/table :db/id :user/score])}]})

wilkerlucio19:10:04

what you think about this approach?

tony.kay19:10:25

@wilkerlucio Well, the plus is you don't generate unneeded code. I really think this is a problem in core Om as well. So, I would not want to integrate a solution in Untangled...but I would advocate for something like it in Om. The thing is, it is possible they could hcange the implementation (e.g. the keyword :component could get namespaced) in a way that breaks this function....so they should evolve together.

tony.kay19:10:48

I got the idea of using defui to make queries from David Nolen....it is an accepted and recommended technique for Om

wilkerlucio19:10:33

yeah, I guess making it explicit also gives more information later if you wanna track it

tony.kay19:10:13

and get-query might eventually add other metadata....just too fragile this way without being part of Om

tony.kay19:10:26

then again, easy to fix as Om evolves....well, I think

tony.kay19:10:06

could be that it starts adding metadata related to something else on the component, in which case you're better off with defui overall. I'd be happy with an alias for defui...like defquery

tony.kay19:10:26

well, maybe not an alias, but something that assumes you might want a query + ident.

wilkerlucio19:10:41

umhum, gotcha, the stability seems reason enough to use the query component, I'll refactor to use that on my code, thanks @tony.kay for your input

anmonteiro19:10:49

@tony.kay @wilkerlucio IMO you should just use defui for the reasons Tony mentioned and also because of future enhancements like better error messages and stuff

anmonteiro20:10:11

also, I don’t think Om is going to add any sugary stuff, so defquery would probably need to be in user land

tony.kay20:10:33

Yes, I understand that. David has refused all manner of sugar 🙂

tony.kay20:10:45

no hyper-glycemia happening in that library

jasonjckn21:10:31

thanks for the docs!

tony.kay22:10:46

Welcome, @jasonjckn. Be glad to hear feedback or accept PRs. Really trying to make this stuff easy to learn.

jasonjckn22:10:17

I recall some roll back mechanism for optimistic updates you were talking about ? docs? examples?

tony.kay22:10:32

for optimistic updates? No

tony.kay22:10:39

server errors

tony.kay22:10:54

optimistic is local and deterministic within your mutation

jasonjckn22:10:15

maybe I should read those docs you wrote 🙂

jasonjckn22:10:39

what was the rollback thing you guys were talking about? this was server side? docs?

jasonjckn22:10:49

was this specific to datomic?

tony.kay23:10:10

should totally be defmethod