Fork me on GitHub
#fulcro
<
2020-07-05
>
murtaza5208:07:39

(defresolver tax-ids [_ {:account/keys [id]}]
  {::pc/input  #{:account/id}
   ::pc/output [:tax/id]}
  (jdt/get-tax-ids id)})
The above resolver does not work, it throws an error, reason being that its returning a collection. I have many computed columns for which I need the above :tax/id as an input. The approach that works is below -
(defresolver tax-ids [_ {:account/keys [id]}]
  {::pc/input  #{:account/id}
   ::pc/output [{:tax-ids [:tax/id]}]
  {:tax-ids (jdt/get-tax-ids id)})}
However using the second approach I can not chain the :tax/id. I need this as an input for other computed attribute.

Jakub Holý (HolyJak)09:07:41

#pathom is the place to ask. I believe resolvers must return a map.

Jakub Holý (HolyJak)09:07:51

Could you explain your need more? How do you want to use the tax ids as a collection? Normally you would do the 2nd example and ask for :tax-ids in your query. Why doesn't this work? What do you mean by chaining tx/id?

Jakub Holý (HolyJak)09:07:26

Asking for [:account/id :tax-ids] and getting back {:account/id 1 :tax-ids [1 2..]} makes perfect sense to me

zilti10:07:30

Did you try ::pc-output [[:tax/id]] as well?

zilti10:07:13

But yea, generally you'll want the result be a map anyway, how else would you merge it into the normalized db

jmayaalv08:07:21

the rule i follow is if it’s a global resolver or a join you return a map

Eric Ihli21:07:50

If I want to mount a Fulcro application inside an Angular application, is it possible & most reasonable (in Fulcro-land, not Angular-land) to do it by accessing whatever I need straight from window? .fulcrologic.fulcro.application.mount_BANG_(...)?

Eric Ihli22:07:40

Ah. I found that while exploring the console in a development app. I see in a release build I only have access to my entry namespace on window. I'll just give myself whatever I need from there.