This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-27
Channels
- # announcements (10)
- # aws (11)
- # beginners (158)
- # calva (8)
- # cider (14)
- # clj-kondo (1)
- # cljsrn (1)
- # clojure (83)
- # clojure-europe (5)
- # clojure-italy (25)
- # clojure-nl (3)
- # clojure-spec (12)
- # clojure-uk (20)
- # clojurescript (72)
- # community-development (18)
- # core-async (4)
- # core-logic (19)
- # cursive (11)
- # datomic (21)
- # duct (6)
- # events (1)
- # figwheel-main (3)
- # fulcro (15)
- # ghostwheel (1)
- # jobs (1)
- # leiningen (16)
- # off-topic (45)
- # onyx (3)
- # pathom (7)
- # perun (1)
- # ring (3)
- # shadow-cljs (48)
- # spacemacs (10)
- # specter (1)
- # sql (24)
- # tools-deps (7)
- # vscode (7)
- # xtdb (14)
hm the example here: https://wilkerlucio.github.io/pathom/v2/pathom/2.2.0/graphql/fulcro.html doesn’t seem to work because namespaces like fulcro.client.network don’t exist
Hm. The examples are using fulcro 2 ... This needs to be updated. 😉
@roklenarcic yeah, for F2, I don't have a shared library with that yet, but you can use this (rename the ns
to something that makes sense to you):
(ns remote-pathom
(:require [edn-query-language.core :as eql]
[com.wsscode.common.async-cljs :refer [<?maybe]]
[com.fulcrologic.fulcro.algorithms.tx-processing :as txn]
[cljs.core.async :refer [go]]))
(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
(try
(ok-handler {:body (<?maybe (parser {} edn))})
(catch :default e
(js/console.error "Pathom Remote error:" e)
(error-handler {:body e}))))))})
A Small lib to qualify/unqualify data with #pathom Docs still WIP. https://github.com/souenzzo/eql-as
I’m trying to dispatch a server-property load!
call in fulcro to a pathom resolver with params. the server property seems to be getting picked up properly, but the params
I added in the options map of load!
don’t seem to be getting parsed by pathom and fed into my resolver as params. any suggestions for how to debug?
There's a Pathom plugin from Fulcro RAD that will fix this. This one is just slightly altered:
(def query-params-to-env-plugin
"Adds top-level load params to env, so nested parsing layers can see them."
{::p/wrap-parser
(fn [parser]
(fn [env tx]
(let [children (-> tx eql/query->ast :children)
query-params (-> (->> children
(reduce
(fn [qps {:keys [type params] :as x}]
(cond-> qps
(and (not= :call type) (seq params)) (merge params)))
{}))
(dissoc :pathom/context))
env (assoc env :query-params query-params)]
(parser env tx))))})