-
-
Notifications
You must be signed in to change notification settings - Fork 433
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
Scope on morphTo directive applied to source model, rather than target #2106
Comments
Right, the current behaviour is somewhat nonsensical. To properly support scopes on polymorphic relations, the definition has to take the type of the related model into account. I got a PR on this going, but it needs a bunch more work to be finished. @dennis-koster please review #2110 |
@spawnia Hi Spawnia, thanks for drafting up a PR! I think the idea of specifying which model you want to apply what scope(s) to makes sense. I wonder if this would work in combination with the union type though, as in my example. Perhaps it would be beneficial to add a test for that scenario as well. |
Describe the bug
When applying a scope to the
morphTo
directive, it appears that Lighthouse is trying to apply the scope to the root model, rather than then target relationship. For instance, given the following schema:Lighthouse is trying to apply the
active
scope to thePublication
model, rather than theMagazine
orBook
model.Expected behavior/Solution
The scope should be applied to the query responsible for fetching the
Magazine
orBook
.Steps to reproduce
See above example.
Lighthouse Version
v5.23.1
The text was updated successfully, but these errors were encountered: