nuwave / lighthouse

A framework for serving GraphQL from Laravel
https://lighthouse-php.com
MIT License
3.36k stars 438 forks source link

Eager load multiple nested relations using @with #2525

Open spawnia opened 6 months ago

spawnia commented 6 months ago

Resolves https://github.com/nuwave/lighthouse/issues/1132, probably also https://github.com/nuwave/lighthouse/issues/1873

Changes

Breaking changes

robsontenorio commented 3 months ago

In this exactly old version 5.70.3, the nested relationship eager loading works . But not on latest state version 6.x.

type Bar { 
      city: City  @method(name: "handleCity") @with(relation: "city.state")
}
robsontenorio commented 3 months ago

By the way , I have tested this PR and works fine, solve the problem. If you need some help to merge it let me know.

spawnia commented 3 months ago

By the way , I have tested this PR and works fine, solve the problem. If you need some help to merge it let me know.

The changes I made fix eager loading of multiple @with, but break other scenarios - see https://github.com/nuwave/lighthouse/actions/runs/9380728096/job/25828392738. Thus, it can not be merged as is, the final solution will have to look different.