lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

`@with` directive fails to eager-load multiple nested relations on the same parent relation

Open cradigan opened this issue 3 years ago • 1 comments

I've come across what i think is a bug involving the use of multiple @with directives

Here is an example schema:

type User{
   viewerSummary: ViewerSummary
     @with(relation: "shows.producers")
     @with(relation: "shows.actors")
     @with(relation: "films.producers")
     @with(relation: "films.actors")
     @method(name: "getViewerSummary")
}

In the given example, after loading a user with viewerSummary, actors are eager-loaded but producers are not.

Expected behavior/Solution

I would expect both relationships (producers & actors) to be eager loaded

Lighthouse Version

v5.63

cradigan avatar Oct 31 '22 11:10 cradigan

This issue was uncovered in https://github.com/nuwave/lighthouse/pull/1915 and has not been fixed yet, see https://github.com/nuwave/lighthouse/blob/26c25e9eadd0b5aecdd637a84354b82d93e2e9bd/tests/Integration/Schema/Directives/WithDirectiveTest.php#L306-L308.

https://github.com/nuwave/lighthouse/issues/1873 is related, it is probably a good idea to work on both issues at once.

spawnia avatar Oct 31 '22 12:10 spawnia

Duplicate of https://github.com/nuwave/lighthouse/issues/1132.

spawnia avatar Jun 05 '24 08:06 spawnia