Hi people, I would like to split the definitions of my schema into several files. Is it possible to do that on lacinia
?
I think the schema is just EDN, so you can read the files and merge them before you pass it into lacinia
Yeah, I just did that. Thanks!
Hello there. I'm looking for a pattern that handles UI submission of mutations, and receipt of response data, particularly in reagent.
What I have so far are input and submit button components, where input is parsed into the mutation arguments, and the submit button increments a "submissions" ratom. The ratom is dereferenced by the component that issues the mutation. Problem is, when submissions gets swap/inc'ed, entire tree is re-rendered up to where the ratom was instantiated (not, as hoped, only where it gets deref'ed).
this sounds like a #reagent question, not a #graphql question
it could depend on how you are instantiating / passing around the ratom
I think you're right - the ratom question is more for #reagent, but I still wonder if there is a good pattern for UI-driven mutations and result handling.
at work, we’ve built a framework using apollo and reagent so that we can push/pull data and represent them as ratoms or promises
Oh apollo? I thought that was hard to incorporate in a cljs codebase
typically, a mutation is fired via some action (e.g. a button click). We swap an atom to indicate that the action has fired and notify the user via some UI update. apollo automatically detects that some data in a particular query that components has pulled changed via the mutation, and will then re-query in those components
nope, wasn’t too hard at all
we don’t use apollo-react, the base apollo-client library is much more amenable to integration with Reagent
ahh that explains. What makes apollo-react hard to intergrate?
(oh, sorry I am hijacking a conversation, I just got interested ^^)
using regular react components in Reagent is quite a pain. the patterns that apollo-react uses (HoC and children-as-fn) require lots of converting to- and from- Reagent to React
hehe it’s OK 😄
with a thinner wrapper around React, apollo-react can be used seamlessly
didn’t you write hx? Would it be easier to integrate with that?
I did 🙂 yes, I have an internal app at work I wrote using hx + react-apollo and it was quite seamless
cool! I really like your approach with hx
it feels counterproductive to put layers on top of such a moving target like React 🙂!
yeah I think there’s some seriously cutting edge things coming out of React this year that we will want to build on top of
and unfortunately, libraries like Reagent are not directly compatible with them
Ah, so mutation issuance depends on a ratom driven re-render?
I don’t think so. I’m not sure I understand the question
“issuance”?
the mutation is fired when the button is clicked. we swap a ratom to indicate that an action is in progress
re-querying for the data is done elsewhere
just for giggles, I made an example with react-apollo: https://gist.github.com/Lokeh/bee8fd2010a801354dcbfe7bda371d85
thanks, that helps!