hey all, i'm using apollo graphql in my cljs project and i'm facing cache issues
when i'm running "watch-query" with cache hit, apollo return the js object and skips my on-success handler that js->clj the result
when i disable the cache, everything works fine, but when the cache is on and has a hit, i get an error when i'm trying to apply a clj function on a js object.
i have tried to create a link (middleware) to transform the result, but then apollo can't cache it (as the data now is keywordized)
:keywordize-link
(new ApolloLink
(fn [operation forward]
(let [obs (forward operation)]
(.map obs (fn [result]
(let [kw-data (js->clj$ (.-data result))] ; js->clj with keyword keys
(set! (.-data result) kw-data)
result))))))
i'm looking for a way to transform the result for all queries (also cached) on read
did anyone face this issue?
i have posted it as well in the apollo community (https://community.apollographql.com/t/apollo-cache-js-object-transformation-on-read/9382)seems like the result is just an observable, so i could map it
(-> client (.watchQuery options) (.map js->clj) (.subscribe my-callback))
and ditched the ApolloLink