This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-12
Channels
- # announcements (65)
- # aws (1)
- # babashka (12)
- # beginners (111)
- # bristol-clojurians (1)
- # cider (32)
- # clj-kondo (55)
- # clojars (3)
- # clojure (71)
- # clojure-europe (17)
- # clojure-france (4)
- # clojure-italy (36)
- # clojure-losangeles (8)
- # clojure-nl (6)
- # clojure-uk (115)
- # clojurescript (2)
- # datomic (99)
- # fulcro (32)
- # graalvm (12)
- # graphql (20)
- # hoplon (203)
- # meander (56)
- # mount (3)
- # off-topic (17)
- # pathom (17)
- # reitit (22)
- # shadow-cljs (32)
- # spacemacs (9)
- # tools-deps (19)
- # vim (25)
- # vscode (3)
com.wsscode.pathom.fulcro.network
is depending on fulcro 2
Is there a way to use pathom on the client with fulcro 3?@mroerni yes, but you have to implement, its quite simple, here is an example:
(ns pathom-remote-fulcro3
(:require [com.fulcrologic.fulcro.algorithms.tx-processing :as txn]
[com.wsscode.async.async-cljs :refer [go-promise <?maybe]]
[edn-query-language.core :as eql]))
(defn pathom-remote [parser]
{:transmit!
(fn transmit! [_ {::txn/keys [ast result-handler]}]
(let [edn (eql/ast->query ast)
ok-handler (fn [result]
(try
(result-handler (assoc result :status-code 200))
(catch :default e
(js/console.error e "Result handler for remote failed with an exception."))))
error-handler (fn [error-result]
(try
(result-handler (merge error-result {:status-code 500}))
(catch :default e
(js/console.error e "Error handler for remote failed with an exception."))))]
(go-promise
(try
(ok-handler {:body (<?maybe (parser {} edn))})
(catch :default e
(js/console.error "Pathom Remote error:" e)
(error-handler {:body e}))))))})
@wilkerlucio a dynamic resolver is one that doesn't have fixed input and output. What does ::pc/provides
of such resolver look like? What about oir and io indexes for dynamic resolvers?
there is no output or provides on dynamic resolvers (in the new model) in the past there was a ::pc/compute-output
, but that's not used in the new reader. what matters is how you build the index to point to this resolvers, Pathom will try to accumulate all the calls for that and run a single one
there is some things to figure still, if you look at how pathom is dealing with foreign parsers, its another example of how dynamic resolvers work
another question: why the code here throw exception if ::pc/output
is not specified? https://gist.github.com/myguidingstar/06d912afb73087bba6b3a01abf7e9db8 (Though the pathom-datomic resolver still doesn't have ::pc/output
!!!)
what exactly throws that? is this some spec validation? it should not require it
{:a/x :com.wsscode.pathom.core/reader-error, :com.wsscode.pathom.core/errors {[:a/x] "class clojure.lang.ExceptionInfo: No output available - #:com.wsscode.pathom.connect{:sym dev/my-resolver}"}}
the result if I comment out the line ::pc/output []
@slawek098 the parser is just a function, in any case the work is about reading the EQL query somehow (usually on the POST body), pass that to the parser and encode the response