Fork me on GitHub
#pathom
<
2020-09-24
>
Michael W21:09:42

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?

wilkerlucio21:09:50

@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 W21:09:43

@wilkerlucio Perfect that fixed the issue.