graphql

rakowa 2019-05-06T02:45:04.060700Z

Just to clarify, you're not using the mutation response data? I was hoping to, instead running a separate query.

lilactown 2019-05-06T02:45:57.061700Z

I don’t use it directly, but I believe apollo does

rakowa 2019-05-06T02:46:57.063200Z

Seems it would be more efficient, esp, if your mutation can respond with all the data you need to render.

lilactown 2019-05-06T02:47:29.063700Z

apollo keeps a normalized cache of the data returned from the GraphQL endpoint, and will update queries that are observing it when one of their data dependencies change (e.g. from a mutation) from the cache

rakowa 2019-05-06T02:47:51.064300Z

Also, I might need at least the _id to allow running the separate query.

lilactown 2019-05-06T02:48:14.064800Z

I think that we don’t take advantage of that too much since our mutations are kind of weird.

stefan 2019-05-06T05:02:44.066600Z

I followed the example in the gist, but I’m getting an error that the query prop is undefined for some reason

stefan 2019-05-06T05:03:18.066800Z

(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"])))])

lilactown 2019-05-06T05:07:46.068200Z

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

lilactown 2019-05-06T05:07:58.068600Z

it should be 0.5.1

stefan 2019-05-06T05:09:24.068800Z

that did it! thanks 🙏