Fork me on GitHub
#pathom
<
2020-06-30
>
souenzzo20:06:45

(parser env [(op {:arg 1}) (op {:arg 2})]) is a antipattern?

dvingo01:07:19

I think that's just due to a detail of the current fulcro server transaction processing implementation. I believe it can be updated to work with multiple mutations of the same name

souenzzo01:07:42

context: I'm working just with pathom, there is no frontend in my app 🙂

dvingo11:07:56

ahh, yea I'm trying it out and it looks like you're right, it is happening at the pathom level:

(parser {} '[(test-mutations/test-mutation {:param 1}) (test-mutations/test-mutation {:param 2})])
=> #:test-mutations{test-mutation {}}
where the mutation just returns {} and with a different name:
(parser
    {}
    '[(test-mutations/test-mutation {:param 1})
     (test-mutations/test-mutation2 {:param 2})])

=> #:test-mutations{test-mutation {}, test-mutation2 {}} 

wilkerlucio14:07:28

no anti pattern, this is a supported feature on EQL :)

👍 3
souenzzo20:06:30

#fulcro do not like multiple ops in transactions

wilkerlucio14:07:46

not sure what you mean, fulcro is totally ok with multiple ops in transactions

wilkerlucio14:07:13

what happens is that you can't have transaction guarantees between the ops, but if they are separated operations its a fine to call as many as you want

dvingo17:07:41

I think he's referring to if the operation is the same symbol

dvingo17:07:00

you get back a map so you their responses are "merged"

dvingo17:07:47

[(op {:a 1}) (op {:a 2})] => {op {:answer 1}}

dvingo17:07:08

for example - what if one of the calls fails, but one of them succeeds?

souenzzo17:07:25

I'm using pathom-as so no problem

dvingo17:07:23

do you have a link for that? I haven't heard of that

souenzzo17:07:25

you can do [(op {:pathom/as :a}) (op {:pathom/as :b})] ;;=> {:a ... :b ...} @U051V5LLP

dvingo17:07:23

oh interesting! thanks

lgessler23:06:39

hi, is there a way to put state into the environment on a per-query basis? i want to create a database session per query, but the body of a defresolver isn't the right place to do it because any other resolvers that are involved won't have access to it

lgessler23:06:05

nvm, found the answer in the docs

🆒 3