Skip to content

Cursor pagination with 'last' and 'before' #427

@BRUS1NATOR

Description

@BRUS1NATOR

I had unexpected results on my frontend app when I have tried to paginate backward.
I'm using the demo project to reproduce this issue.
Considering data:
image
When paginating forward I get endcursor with value "Mg==" which is expected.
image
Then try to get previous node with arguments (last:1, before: "Mg==") and expecting to get entity with id = 1. As you can see I get correct node with previous cursor "MQ==", but id of entity is incorrect.
image
If I try to get 2 entities instead of 1, the returned cursors are kinda "shifted". Entity with id=1 has cursor "MA==".
image

I think it has something to do with cursor computation when using 'last' argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions