Skip to content

Nested dynamic inputs bug #92

@wilkerlucio

Description

@wilkerlucio
(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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions