This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-31
Channels
- # announcements (5)
- # babashka (5)
- # beginners (24)
- # calva (21)
- # cherry (1)
- # clerk (20)
- # clj-kondo (3)
- # clj-otel (12)
- # clojure (50)
- # clojure-austin (2)
- # clojure-conj (3)
- # clojure-europe (40)
- # clojure-nl (1)
- # clojure-norway (203)
- # clojure-spec (3)
- # clojure-uk (6)
- # clojurescript (8)
- # conjure (1)
- # datomic (1)
- # deps-new (1)
- # emacs (5)
- # graphql (8)
- # gratitude (5)
- # holy-lambda (16)
- # honeysql (18)
- # hyperfiddle (12)
- # java (1)
- # jobs (1)
- # lsp (24)
- # membrane (8)
- # nbb (1)
- # off-topic (19)
- # portal (28)
- # proletarian (9)
- # rdf (63)
- # re-frame (38)
- # reagent (8)
- # reitit (1)
- # releases (6)
- # remote-jobs (1)
- # scittle (4)
- # shadow-cljs (20)
- # spacemacs (4)
- # sql (7)
- # transit (1)
I think some of the changed in lacinia 1.2 broke subscriptions. I have part of the fix in lacinia-pedestal, but I may need to change lacinia to make it fully work and work properly. This has me bummed.
Essentially, for subscriptions, lacinia-pedestal invokes the streamer for the subscription field (e.g., Subscription/ticks in the https://github.com/walmartlabs/lacinia-pedestal/blob/master/dev-resources/demo-schema.edn, passing it a source-stream callback function. The thread started by the streamer function passes a value to the callback, which becomes the resolved-value when executing the query. That's a problem, because the query selection is for the subscription field (Subscription/ticks) but the value is a tick object. So the selection is right, but the value is wrong; it has to be wrapped with the fields name (:ticks in this case) so that when the query executes, there's a non-null value to perform sub-selections on (the :count and :time_ms fields from the selection).
That works for the success case, but if the callback is passed a wrapped value (such as via with-error
) then things are not working correctly; the errors are ignored and lacina then performs the sub-selections on a nil value, triggering validation errors about non-null fields.
So the layers of indirection are making me dizzy, but I'm sure there's a solution here, somewhere.
Current state is https://github.com/walmartlabs/lacinia-pedestal/tree/hls/132-fix-graphiql-headers. So far, the main change is https://github.com/walmartlabs/lacinia-pedestal/blob/21df864439db198aae565be0b2472145d9660305/src/com/walmartlabs/lacinia/pedestal/subscriptions.clj#L385 where the stream value is wrapped in a map, but again, that's not sufficient when there's an error.