Skip to content

Conversation

NizarBerjawi
Copy link
Contributor

When use_cursor_pagination is set to true, all the links returned by the paginator do not have query string values appended. This bug was introduced here: d2e38a2

For example:
When I make a request to:
GET /cursor?page[size]=5&page[cursor]=eyJpZCI6MTAsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0

I expect the next and prev links to look like this in the links data:

"links": { "prev": "http://localhost:8080/cursor?page[size]=5&page[cursor]=eyJpc28zMTY2X2FscGhhMiI6IkFRIiwiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ, "next": "http://localhost:8080/cursor?page[size]=5&page[cursor]=eyJpc28zMTY2X2FscGhhMiI6IkJJIiwiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ } 

However, those links lose all query parameters other than the page[cursor] and the actual links I'm receiving, look like this:

"links": { "prev": "http://localhost:8080/cursor?page[cursor]=eyJpc28zMTY2X2FscGhhMiI6IkFRIiwiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ, "next": "http://localhost:8080/cursor?page[cursor]=eyJpc28zMTY2X2FscGhhMiI6IkJJIiwiX3BvaW50c1RvTmV4dEl0ZW1zIjp0cnVlfQ } 

To fix this, I've appended the rest of the query parameters to the cursor paginator.

@freekmurze freekmurze merged commit f181995 into spatie:main Nov 19, 2022
@freekmurze
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants