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

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

Closed
cradigan opened this issue Oct 31, 2022 · 2 comments
Labels
bug An error within Lighthouse

Comments

@cradigan
Copy link
Contributor

cradigan commented Oct 31, 2022

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

@spawnia
Copy link
Collaborator

spawnia commented Oct 31, 2022

This issue was uncovered in #1915 and has not been fixed yet, see

public function testEagerLoadsMultipleNestedRelationsAtOnce(): void
{
$this->markTestSkipped('Not working due to the current naive usage of \Illuminate\Database\Eloquent\Collection::load() in \Nuwave\Lighthouse\Execution\ModelsLoader\SimpleModelsLoader::load().');
.

#1873 is related, it is probably a good idea to work on both issues at once.

@spawnia spawnia added the bug An error within Lighthouse label Oct 31, 2022
@spawnia spawnia changed the title Issue using multiple @with directives pointed at deeply nested relationships (using dot notation) @with directive fails to eager-load multiple nested relations on the same parent relation Oct 31, 2022
@spawnia
Copy link
Collaborator

spawnia commented Jun 5, 2024

Duplicate of #1132.

@spawnia spawnia closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error within Lighthouse
Projects
None yet
Development

No branches or pull requests

2 participants