This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-05
Channels
- # babashka (1)
- # beginners (75)
- # clojure (8)
- # clojure-uk (7)
- # clojurescript (15)
- # code-reviews (6)
- # conjure (5)
- # cursive (13)
- # data-science (1)
- # datomic (46)
- # fulcro (10)
- # helix (15)
- # jackdaw (1)
- # jobs-discuss (10)
- # jobs-rus (1)
- # off-topic (17)
- # pathom (1)
- # re-frame (19)
- # releases (1)
- # spacemacs (9)
- # sql (29)
- # test-check (18)
- # tools-deps (6)
- # xtdb (3)
(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.#pathom is the place to ask. I believe resolvers must return a map.
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?
Asking for [:account/id :tax-ids] and getting back {:account/id 1 :tax-ids [1 2..]} makes perfect sense to me
But yea, generally you'll want the result be a map anyway, how else would you merge it into the normalized db