-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
SelectFields will only fire relationship query once and therefore with wrong arguments #604
Comments
How did it end? We ran into the same issue :( |
I made a solution, but it was quite hacky, so it was not accepted, see here: #612
|
Yes, I saw it. I can't help as I'm not into the core of it. |
My personal take (as I've expressed in #612 (review) ): I don't think the approach using Although the GraphQL spec stays highly absent in talking about how to fetch the data, using dataloaders is a very common and well understood technique. Since graphql-laravel is a thin wrapper over graphql-php, everything from e.g. https://webonyx.github.io/graphql-php/data-fetching/#solving-n1-problem should apply. And this is in fact how I've approached this in all my projects and it works very well and also is datasource agnostic, as it simply doesn't matter whether it's Eloquent, ElasticSearch, etc. I would love to be proven wrong, but I don't think this will be solved in |
Maybe we should add a "caveat" section to the readme and note some known limitations? 🤔 |
I was looking into this #602 and fell over this bug.
With this query:
The profile relationship is only run once and therefore the different arguments given to the custom query clause is not taken into account, only the last query get the right args.
It seems a bit to hard to fix since it is not easily possible to alias eloquent relationships.
Unfortunately something like this is not possible. This would have made it a simplier fix
User::with('relationship', 'relationship AS other')->get();
The text was updated successfully, but these errors were encountered: