This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-23
Channels
- # announcements (19)
- # babashka (6)
- # beginners (47)
- # cljs-dev (4)
- # cljsrn (3)
- # clojure (18)
- # clojure-australia (3)
- # clojurescript (50)
- # code-reviews (1)
- # conjure (16)
- # datomic (6)
- # editors (4)
- # emacs (1)
- # fulcro (10)
- # graphql (3)
- # helix (7)
- # jackdaw (10)
- # malli (1)
- # off-topic (3)
- # pathom (4)
- # sci (2)
- # shadow-cljs (39)
- # testing (3)
- # tools-deps (5)
- # vscode (1)
I am using Pathom 2.3.1 with Fulcro and I don't know why my mutations don't work with this parser:
(ns com.yardwerkz.local-store.parser
(:require
[com.wsscode.pathom.core :as p]
[com.wsscode.pathom.connect :as pc]
[cljs.core.async :as async :refer-macros [go]]
[com.wsscode.async.async-cljs :refer [go-catch <!p <?]]
[taoensso.timbre :as log]
[com.wsscode.pathom.trace :as pt]
[cognitect.transit :as t]
["@react-native-async-storage/async-storage" :default AsyncStorage]))
(defn set-item
[key item]
(let [w (t/writer :json)
enc-item (t/write w item)]
(.setItem AsyncStorage key enc-item)))
(defn get-item
[key]
(let [r (t/reader :json)]
(.then (.getItem AsyncStorage key) #(t/read r %))))
(defn remove-item
[key]
(.then (.removeItem AsyncStorage key)))
;;;;; Resolvers for local-store must be written asynchronously.
(pc/defresolver index-explorer [env _]
{::pc/input #{:com.wsscode.pathom.viz.index-explorer/id}
::pc/output [:com.wsscode.pathom.viz.index-explorer/index]}
{:com.wsscode.pathom.viz.index-explorer/index
(get env ::pc/indexes)})
(pc/defmutation save-user-id [env {:keys [user-id]}]
{::pc/input #{:user-id}}
(log/debug "save-user-id" user-id)
(go
(<!p (set-item "@user-id" user-id))))
(pc/defresolver get-user-id [_ _]
{::pc/output [:user-id]}
(go
(let [user-id ("}}
::p/mutate pc/mutate-async
::p/plugins [(pc/connect-plugin {::pc/register resolvers})
p/error-handler-plugin
p/trace-plugin]}))
(comment
(go (prn (async/<! (parser {} ('save-user-id {:user-id "c"}))))))
When I put the line from the comment block into my CLJS repl, i get {}
. If i put and undefined mutation symbol, I get {}
. I would appreciate any help given. Thanks1You need to put your quote outside the paren I think
Right now your symbol is trying to do a map lookup