You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am experiencing an issue with back pagination, after using last and before props with startCursor of the "nextPage" I can't go back to previous products.
@Nico2d Can you try changing your orderby input to { field: NAME } or { field: NAME, order: ASC}. Iirc when you use the before and last the default sort is actually reversed by the WPGraphQL core's AbstractConnectionResolver class' logic. In you're last example the startCursor corresponds with the product with ID 806 when the result list is reversed by last and before, with your orderby.order: DESC input applied to the query, it get last ten that came before it alphabetic which in this case which is product with IDs 805-661, and not 884-806.
What I'm trying to say with all this is the sort in the orderby is throwing off your expected sort, just remove the order from you orderby input and use first and last to control you sort order if you plan on paginating the list in both directions otherwise when you switch to last and before you have to also invert the orderby.order as well
Describe the bug
I am experiencing an issue with back pagination, after using
last
andbefore
props withstartCursor
of the "nextPage" I can't go back to previous products.To Reproduce
My query:
Products on the 1 page:

Products on the 2 page:

(using the
endCursor
tag on after property)Try to go back to 1 page:
(using the
startCursor
tag onbefore
property and change usingfirst
tolast
)As you can see, there is different products then on page 1, and we didn't get
hasPreviousPage: false
Expected behavior
After using before we should go back to previous page
Plugin Versions
The text was updated successfully, but these errors were encountered: