Fork me on GitHub
#pathom
<
2020-04-30
>
Tuomas08:04:38

Hi a pathom+clojure newbie here trying to learn how to build fulcro+datomic web app. Despite the docs and examples I’m having a hard time why my mutation isn’t found. In the fulcro inspect query I query for

[{(app.models.session/login
   {:user/email "asd" :user/password "letmein"})
  [:user/token]}]
and get
{app.models.session/login
 {:com.wsscode.pathom.core/reader-error
  "Mutation not found - {:mutation app.models.session/login}"}}
I looked at archives and saw a tip to the check if its in the index and it seems to be there
(p/env-wrap-plugin (fn [env]
                                       (println "index-mutations" (get-in env
                                                                      [:com.wsscode.pathom.connect/indexes
                                                                       :com.wsscode.pathom.connect/index-mutations
                                                                       'app.models.session/login]))
; index-mutations {:com.wsscode.pathom.connect/sym app.models.session/login, :com.wsscode.pathom.connect/mutate #object[app.models.session$login__34847 0x347d0002 app.models.session$login__34847@347d0002], :com.wsscode.pathom.connect/output [:user/token]}
                                       (let [conn (app.database/get-connection)]
                                         (assoc env
                                           :db (d/db conn)
                                           :conn conn))))
I tried using ::pc/sym ’login and ::pc/sym ’user/login but I keep getting the same error. I’ll keep going through the docs and examples, but I don’t know what to try next.

fjolne08:04:04

@koivistoinen.tuomas IIRC there was a bug in Inspect with mutations-not-found in the Query tab. have you tried calling Pathom parser directly from the REPL?

Tuomas08:04:21

I haven’t. I’ll figure out how to do it and try it

fjolne08:04:34

it’s actually pretty easy: parser is just a function which takes env and tx if you’re using fulcro-template then the only external thing in the env is ring/request which you can put there by hand (if you really need to i.e. if your resolvers/mutations depend on it), otherwise it’s just (parser {} [{(your-mutation {:param 1}) [:data]}])

Tuomas10:04:15

Huge thanks it works! I struggled a while with an invalid expression error. If everyone has the same problem, be sure to quote the tx

(async/<!! (pathom-parser {} '[{(mutation {:param "value"}) [:selection]}))

fjolne11:04:24

ah yeah, you typically fully-qualify the tx with the syntax-quote and then use ~ for param symbols substitution https://clojure.org/reference/reader

wilkerlucio17:04:10

@koivistoinen.tuomas also, the bug around mutation responses is fixed on the Pathom Viz standalone app, if you wanna use that: https://clojurians.slack.com/archives/C06MAR553/p1587880194322000

4
Björn Ebbinghaus18:04:12

@wilkerlucio The Index Explorer in the latest Fulcro Inspect Binary seems to have broken CSS All classes in the style-tag have unknown_unknown__ as prefix.

Björn Ebbinghaus18:04:42

.unknown_unknown__container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.unknown_unknown__selector {
  font-family: sans-serif;
  user-select: none;
  align-items: center;
  padding: 12px;
  border-top: 1px solid #ccc;
  font-size: 12px;
  display: flex;
  background: #F3F3F3;
  color: #5A5A5A;
}
```

wilkerlucio18:04:16

thats weird, @U0CKQ19AQ you have an idea what may caused this?

wilkerlucio18:04:50

as a secondary option, you can use the standalone pathom app

pathom 4
tony.kay19:04:33

probably just didn’t end up in the electron resources properly

tony.kay19:04:04

oh…unknown unknown….sounds like the binding of *parent* is hosed and it is using garden