Fork me on GitHub
Ryan Khetlyr15:02:45

I'm going through the and at full-stack-1 I was hoping to get an all-cars resolver set up - maybe someone can see what I'm missing? I get

Ryan Khetlyr15:02:10

In I added:

(pc/defresolver all-cars-resolver [env {:car/keys [id]}]
                {::pc/output [{:all-cars [:car/id]}]}
                 (mapv (fn [i] {:cars/id i}) (keys @cars))})

(def resolvers [car-resolver all-cars-resolver])

Ryan Khetlyr15:02:48

tried (restart) in the repl and then a full shutdown and re-load of the IDE to see if that was the issue...


Your ::pc/output doesn't match what you are returning.

👀 1
Ryan Khetlyr18:03:18

still fighting with this... I thought that the other data would get returned from the other resolver... here's what I've got now, still not found

(def cars
  (atom {1 {:car/id    1
            :car/make  "Honda"
            :car/model "Accord"}
         2 {:car/id    2
            :car/make  "Ford"
            :car/model "F-150"}}))

(pc/defresolver car-resolver [env {:car/keys [id]}]
  {::pc/input  #{:car/id}
   ::pc/output [:car/id :car/make :car/model]}
  (get @cars id))

(pc/defresolver all-cars-resolver [env {:car/keys [id]}]
                {::pc/output [{:all-cars [:car/id :car/make :car/model]}]}
                 (mapv (fn [i] {:cars/id i}) (keys @cars))})

Ryan Khetlyr18:03:59

trying to get this to work like people does - this one works great

(pc/defresolver person-resolver [env {:person/keys [id]}]
  {::pc/input  #{:person/id}
   ::pc/output [:person/name :person/age {:person/cars [:car/id]}]}
  (let [person (-> @people
                 (get id)
                 (update :person/cars (fn [ids] (mapv
                                                  (fn [id] {:car/id id})

(pc/defresolver all-people-resolver [env {:person/keys [id]}]
  {::pc/output [{:all-people [:person/id]}]}
   (mapv (fn [i] {:person/id i}) (keys @people))})


What will (mapv (fn [i] {:cars/id i}) [1 2 3]) return?

Ryan Khetlyr20:03:02

Ugh - Thanks so much for your help! in the return I should have had :car/id, not :cars/id


Fulcro's two golden rules: 1. Make sure the query is correct 2. Make sure everything is spelled correctly Good luck!