This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-05
Channels
- # beginners (12)
- # calva (18)
- # cider (1)
- # cljs-dev (29)
- # clojure (97)
- # clojure-uk (18)
- # clojurescript (10)
- # clojureverse-ops (2)
- # cursive (7)
- # emacs (10)
- # fulcro (42)
- # graphql (36)
- # joker (1)
- # juxt (28)
- # mount (2)
- # other-languages (2)
- # pathom (1)
- # portkey (3)
- # re-frame (50)
- # shadow-cljs (42)
- # spacemacs (4)
- # sql (6)
- # yada (6)
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
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).
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
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
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
just for giggles, I made an example with react-apollo: https://gist.github.com/Lokeh/bee8fd2010a801354dcbfe7bda371d85
I followed the example in the gist, but I’m getting an error that the query
prop is undefined for some reason
(defnc concept-select [_]
[apollo/Query {:query (gql "{ concepts { id } }")}
(fn [result]
(let [{:keys [data error loading]} (j/lookup result)]
(cond
loading [:div "loading..."]
error [:p "uh oh..."]
:else [:p "it works"])))])
are you using the latest version of hx
? I had a bug that I pushed a fix for that I discovered in implementing that gist :P
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