Closed mitchelkuijpers closed 2 years ago
Thanks for the report, I'm investigating, I first reduced the example, this is minimal thing I could get to:
(ns com.wsscode.pathom3.demos.repro159-foreign-placeholders
(:require
[com.wsscode.pathom3.connect.foreign :as pcf]
[com.wsscode.pathom3.connect.indexes :as pci]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.interface.eql :as p.eql]))
(pco/defresolver sample-todo []
{:app/sample-todo
{:todo/id 1
:todo/title "Write foreign docs"}})
(def foreign-env (pci/register [sample-todo]))
(def foreign-request
(p.eql/boundary-interface foreign-env))
(def local-env
(pci/register
[(pcf/foreign-register foreign-request)]))
(def local-request
(p.eql/boundary-interface local-env))
(comment
;; This works
(foreign-request
[{:app/sample-todo
[{:>/foo
[:todo/id]}]}])
;; This fails
(local-request
[{:app/sample-todo
[{:>/foo
[:todo/id]}]}]))
Seems that the planner is not being aware of the possible values in the parent when it comes from a nested parent and the value isn't used in the parent of the placeholder.
Yeah it seeems that way it is fixed if I separate sample-todo in two resolvers.
I find it quite hard to explain but I managed to reproduce this bug in small repro: