pathom

:pathom: https://github.com/wilkerlucio/pathom/ & https://pathom3.wsscode.com & https://roamresearch.com/#/app/wsscode
Michael W 2020-09-24T21:11:42.005600Z

Having a weird issue:

(defattr id :network/id :int
  {ao/identity?  true
   ao/pc-input   #{:network/id}
   ao/pc-output  [:network/id :network/name :network/start :network/end :network/parent :network/site]
   ao/pc-resolve (fn [_ {:keys [network/id] :as input}]
                   #?(:clj
                      (transform-network-data (solid/network-id (str id)))))})

(defattr network-name :network/name :string
  {fo/field-label "Network Name"
   ao/required?   true
   ao/pc-input    #{:network/name}
   ao/pc-output   [:network/id :network/name :network/start :network/end :network/parent :network/site]
   ao/pc-resolve  (fn [_ {:keys [network/name]}]
                    #?(:clj
                       (transform-network-data (solid/network-name name))))})

(defattr all-networks :network/all-networks :ref
  {ao/target     :network/id
   ao/pc-output  [{:network/all-networks [:network/id]}]
   ao/pc-resolve (fn [{:keys [query-params] :as env} _]
                   #?(:clj
                      {:network/all-networks (mapv #(Integer/parseInt (:subnet_id  %)) (solid/network-all))}))})
With this in fulcro, I can run the query [:network/all-networks] and get back the full list of ids ok. I can run the query [{[:network/id 33] [:network/name]}] with no issues. But if I try to run a query like this: [{:network/all-networks [:network/name]}] I get an error about contains? not supported on type Integer:
com.wsscode.pathom.core/map-reader     core.cljc:  629
clojure.core/contains?                 core.clj: 1492
                               ...                               
java.lang.IllegalArgumentException: contains? not supported on type: java.lang.Integer
What am I doing wrong?

wilkerlucio 2020-09-24T21:21:50.006800Z

@michael819 the issue is in the value of :network/all-networks, by looking at your code I guess its like this: {:netword/all-networks [1 2 3 4 ...]}, but that's wrong, it needs to be {:netword/all-networks [{:network/id 1} {:network/id 2} {:network/id 3} ...]}

Michael W 2020-09-24T21:22:07.007100Z

Ahhh

Michael W 2020-09-24T21:29:43.007500Z

@wilkerlucio Perfect that fixed the issue.