Fork me on GitHub
#pathom
<
2019-02-25
>
wilkerlucio12:02:56

@eoliphant its an interesting approach, and you are right to be concerned about the consistency across mutations and reads, at this moment pathom doesn't have an answer for this case, specially on the parallel parser since each root entry goes in parallel. that said I still need to see that happening, mutation responses are a much better place to request follow up info then follow-up reads, and if we consider that it might not be a problem, also, if multiple mutations need to coordinate, better transform then in a single mutation where you are free to coordinate as you need. so as I see we have ways around it as it is, the library could improve to have better support for it, but so far it seems to not be needed, makes sense?

eoliphant14:02:09

Hey @wilkerlucio, thanks for the confirmation re: my concerns. But I didn’t quite understand the > mutation responses are a much better place to request follow up info then follow-up reads by mutation response, did you mean a second ‘request’ based on the response from the first?

(parser {} [{(add-foo ..) [:foo/id]}])
(parser {} [{[:foo/id ...] [:foo/bar :foo/baz]}])
; - instead of 
(parser {} [{{(add-foo ..)[:foo/bar :foo/baz]}])

eoliphant14:02:18

also shot you a quick doc pr

souenzzo14:02:46

@eoliphant both

;; 1
[{(add-value) [:app/value]}]
;; 2
[(add-value)
   :app/value]
Are valid and will work But in 1 you say "do the mutation then do the query" In 2 you can "do the mutation and give me this query" In a parallel parser, 2 can query first and then do the mutation

eoliphant15:02:15

gotcha, so in my scenario though, I guess 2 is what I don’t want because I want the :app/value after the add-value?

souenzzo17:02:52

@eoliphant I edited and corrected a detail in the query (removed [] from 2 ). No! 1 will always call :app/value after (add-value) 2 possibly call :app/value before/at the same time.

eoliphant18:02:15

right right, I get that, so in most cases for me I need to use the join syntax, because I again, want to query against the thing the mutation just created/updated/etc

👍 5
souenzzo18:02:01

#fulcro also has the "mutation-merge", that you can use to merge your mutation results.

4
eoliphant18:02:02

ah sweet,I’d seen that haven’t used it though

wilkerlucio19:02:12

@eoliphant I suggest you check then out, they are quite cool, and pathom deals nicely with then as well, in pathom case it uses the response data from the mutation as initial context, and you can query anything on top of it (as long as the mutation response has enough data to figure the rest) https://wilkerlucio.github.io/pathom/#_mutation_joins

5