Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested dynamic inputs bug #92

Closed
wilkerlucio opened this issue Sep 3, 2021 · 0 comments · Fixed by #96
Closed

Nested dynamic inputs bug #92

wilkerlucio opened this issue Sep 3, 2021 · 0 comments · Fixed by #96
Labels
bug Something isn't working dynamic resolvers planner

Comments

@wilkerlucio
Copy link
Owner

(pco/defresolver order-line-items []
  {::pco/output
   [{:order/line-items
     [:line-item/id
      :line-item/quantity
      :line-item/title
      :line-item/price-total]}]}
  {:order/line-items
   [{:line-item/id          "1628545763873-1"
     :line-item/price-total 28.8M}
    {:line-item/id          "1628545763873-2"
     :line-item/price-total 38.9M}]})

(def items-env
  (-> (pci/register
        [order-line-items])
      (assoc ::pci/index-source-id `line-items)))

(def items-request
  (p.eql/boundary-interface items-env))

(pco/defresolver order-items-total [{:keys [order/line-items]}]
  {::pco/input
   [{:order/line-items
     [:line-item/price-total]}]}
  {:order/items-total (transduce (map :line-item/price-total) + line-items)})

(def demo-env
  (-> (pci/register
        [(pcf/foreign-register items-request)
         order-items-total])
      ((requiring-resolve 'com.wsscode.pathom.viz.ws-connector.pathom3/connect-env)
       "debug")))

(comment
  (p.eql/process demo-env
    [:order/items-total]))

The foreign-ast to the order-line-items currently is:

{:children
  [{:dispatch-key :order/line-items,
    :key :order/line-items,
    :type :prop}],
  :type :root}

This is missing the sub-query part, it must include :line-item/price-total in the foreign-ast subquery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dynamic resolvers planner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant