Closed caioflores closed 4 years ago
New discover, it works when I query for just one user:
{
user(id: "96d37a98-cbf4-4acb-baf9-ac9810a5df60") {
tasks(first: 2 after: "WyIwMGNlYTJlNi02ZmM4LTQ0ZGEtODY0My1lNDllZWQ5NGEzYTEiLDBd") {
pageInfo {
startCursor
}
edges {
node {
content
}
}
}
}
}
But doesn't work when I call in all users:
{
users {
id
tasks(first: 2 after: "WyIwMGNlYTJlNi02ZmM4LTQ0ZGEtODY0My1lNDllZWQ5NGEzYTEiLDBd") {
pageInfo {
endCursor
startCursor
}
edges {
node {
id
content
}
}
}
}
}
I found a way to solve this problem, my users query was not using connections and pagination, so it was not expecting edges/nodes.
Now I implemented with connections, and I can use after for users and user tasks:
{
users(first: 1 after: "WyI5NmQzN2E5OC1jYmY0LTRhY2ItYmFmOS1hYzk4MTBhNWRmNjAiLDBd") {
pageInfo {
endCursor
}
edges {
node {
id
tasks(first: 2 after: "WyIxMDIzODY0OS1hY2NiLTQ5ZTQtYTRmYy01YjUyOTk4MWIyZGEiLDFd") {
pageInfo {
endCursor
}
edges {
node {
id
content
}
}
}
}
}
}
}
So I think that it's not a bug?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hello, I'm trying to create a example with connections, but I'm having problems with "after" cursor param. It works fine when a pass first/last param without after, but when I use after sequelize returns this error:
SequelizeDatabaseError: argument of LIMIT must be type bigint, not type integer[]
While making this query:
SELECT "Task".* FROM (SELECT * FROM (SELECT "id", "content", "completed", "createdAt", "updatedAt", "UserId", COUNT(*) OVER() AS "full_count" FROM "Tasks" AS "Task" WHERE "Task"."UserId" = '96d37a98-cbf4-4acb-baf9-ac9810a5df60' ORDER BY "Task"."id" ASC LIMIT ARRAY[2,1]) AS sub UNION ALL SELECT * FROM (SELECT "id", "content", "completed", "createdAt", "updatedAt", "UserId", COUNT(*) OVER() AS "full_count" FROM "Tasks" AS "Task" WHERE "Task"."UserId" = '9afd88c7-5e36-4445-89c0-60cff8b51ecc' ORDER BY "Task"."id" ASC LIMIT ARRAY[2,1]) AS sub) AS "Task";
connection:
Model association:
I'm using PostgreSQL as database and you can see all the code in this PR: https://github.com/sigalei/sigalei-stack/pull/55
Maybe this is a bug?