Fork me on GitHub

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
    [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
  (let [r (t/reader :json)]
    (.then (.getItem AsyncStorage key) #(t/read r %))))

(defn remove-item
  (.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]}
   (get env ::pc/indexes)})

(pc/defmutation save-user-id [env {:keys [user-id]}]
  {::pc/input  #{:user-id}}
  (log/debug "save-user-id" user-id)
    (<!p (set-item "@user-id" user-id))))

(pc/defresolver get-user-id [_ _]
  {::pc/output [:user-id]}
    (let [user-id ("}}
                      ::p/mutate  pc/mutate-async
                      ::p/plugins [(pc/connect-plugin {::pc/register resolvers})

  (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. Thanks1

Chris O’Donnell16:05:13

You need to put your quote outside the paren I think

Chris O’Donnell16:05:55

Right now your symbol is trying to do a map lookup


Thank you @codonnell!

👍 3