Comments (13)
@vestervang Thanks for the head's up! Let me take a look and see if I can reproduce and test it. But yes, there certainly seems to be an issue there.
from lighthouse.
@vestervang I used the lighthouse-example
with the following schema:
type Task {
title: String!
}
type User {
name: String!
email: String!
jobs: [Job!]! @hasMany
}
type Job {
id: ID!
title: String!
user: User @belongsTo
tasks: [Task!]! @hasMany(type: "connection")
}
type Query {
me: User @auth
jobs: [Job!]! @paginate(type: "connection" model: "App\\Job")
}
Sent this query:
{
jobs(first:1) {
pageInfo {
total
startCursor
endCursor
}
edges {
cursor
node {
id
title
tasks(first:2) {
pageInfo {
total
startCursor
endCursor
}
edges {
cursor
node {
title
}
}
}
}
}
}
}
and got the following response:
{
"data": {
"jobs": {
"pageInfo": {
"total": 30,
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjE="
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"id": "1",
"title": "Assumenda ea dolores illo facere.",
"tasks": {
"pageInfo": {
"total": 3,
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjI="
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"title": "Repellendus et tempora eos doloribus odit corporis a aspernatur."
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"title": "Consectetur aut nobis ut."
}
}
]
}
}
}
]
}
}
}
Could you post the newsArticles
relationship on your User
model?
from lighthouse.
Sure thing
User.php
...
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'username',
'password',
'email',
'runescape_name',
'member',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
public function newsArticles()
{
return $this->hasMany(NewsArticle::class);
}
public function newsArticleComments()
{
return $this->hasMany(NewsArticleComment::class);
}
}
from lighthouse.
Man that's odd, that looks completely fine.. What DB and version are you using?
from lighthouse.
MySQL 5.7.21.
Everything works when testing in artisan tinker
from lighthouse.
Just to rule out something weird w/ the User model or the relation
argument, I updated my version of the lighthouse-example
schema to:
type Task {
title: String!
}
type User {
name: String!
email: String!
foo_bar: [Job!]! @hasMany(type: "connection", relation: "jobs")
}
type Job {
id: ID!
title: String!
user: User @belongsTo
tasks: [Task!]! @hasMany(type: "connection")
}
type Query {
me: User @auth
jobs: [Job!]! @paginate(type: "connection" model: "App\\Job")
users: [User!]! @paginate(type: "connection" model: "App\\User")
}
ran this query:
{
users(first:1) {
pageInfo {
startCursor
endCursor
total
}
edges {
cursor
node {
email
foo_bar(first: 2) {
pageInfo {
startCursor
endCursor
total
}
edges {
cursor
node {
id
}
}
}
}
}
}
}
but I still got the expected output:
{
"data": {
"users": {
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"total": 10
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"email": "[email protected]",
"foo_bar": {
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjI=",
"total": 3
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"id": "1"
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"id": "2"
}
}
]
}
}
}
]
}
}
}
Can you run composer update nuwave/lighthouse
just to confirm you have the most updated version?
from lighthouse.
Just updated my composer. No updates for lighthouse.
I'm running "nuwave/lighthouse": "dev-master"
from lighthouse.
I pulled down dev-master
and even nested another level but I'm still getting the correct pageInfo
. Could you try to reproduce the error w/ the lighthouse-example repo or if you could create a new repo for me to debug that would be great!
{
users(first:1) {
pageInfo {
startCursor
endCursor
total
}
edges {
cursor
node {
email
foo_bar(first: 2) {
pageInfo {
startCursor
endCursor
total
hasNextPage
}
edges {
cursor
node {
id
tasks(first:3) {
pageInfo {
startCursor
endCursor
total
hasNextPage
}
edges {
cursor
node {
title
}
}
}
}
}
}
}
}
}
}
{
"data": {
"users": {
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"total": 10
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"email": "[email protected]",
"foo_bar": {
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjI=",
"total": 3,
"hasNextPage": true
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"id": "1",
"tasks": {
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjM=",
"total": 3,
"hasNextPage": false
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"title": "Repellendus et tempora eos doloribus odit corporis a aspernatur."
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"title": "Consectetur aut nobis ut."
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjM=",
"node": {
"title": "Animi a necessitatibus dolores enim cupiditate."
}
}
]
}
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"id": "2",
"tasks": {
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjE=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjM=",
"total": 3,
"hasNextPage": false
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjE=",
"node": {
"title": "Et autem vitae sed sapiente."
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"title": "Occaecati eos aut voluptatibus veritatis."
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjM=",
"node": {
"title": "Explicabo quia error fugit neque qui."
}
}
]
}
}
}
]
}
}
}
]
}
}
}
from lighthouse.
Okay finally got around to create a repo with my code.
https://github.com/vestervang/lighthouse-test
I hope this helps find the issue because I sure can't.
from lighthouse.
@vestervang I see it! Might not be able to really dig in until this afternoon but I'll let you know as soon as I have a fix!
from lighthouse.
@vestervang looks like the count field requires snake_case... re-pull from master
and let me know if that resolved the issue on your end!
from lighthouse.
That solved the problem! Thanks for the help and hard work.
from lighthouse.
Awesome, thanks for reporting the issue!!!
from lighthouse.
Related Issues (20)
- Multiple queries / mutations in single request stop at first error HOT 3
- I faced issue lighthouse middleware HOT 1
- work with Multiple database connection HOT 1
- NOT_LIKE operator not working HOT 1
- ебаные пидорасы
- Directives for root types HOT 3
- Schema cache leaks memory with Laravel Octane HOT 1
- I have problems with many-to-many connections
- GraphQL integration in Laravel Repository Pattern
- Can not solve multiple file upload
- [FEDERATION] error SATISFIABILITY_ERROR when check the schema HOT 2
- `@in` directive breaks if client sends null HOT 1
- "No query results for model [App\\Models\\Permission]." using @create mutation HOT 4
- When using throttle directive how can the client be informed when they can retry again etc. HOT 3
- `@can` directive improvements HOT 1
- Only allow deletion of related models in nested mutations
- `@can` with `injectArgs: true` doesn't inject args passed as variables HOT 3
- laravel lighthouse graphql getting error Content-Type multipart/form-data HOT 3
- Best practices link in documentation is broken HOT 5
- [URGENT] Lighthouse Auth AuthServiceProvider::guards() Return value must be of type array, string returned HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lighthouse.