I've been trying to configure server-side pagination on a table displaying data from a DynamoDB database but i've been running into errors and can't find evidence of anyone having done it successfully anywhere online.
I've made a few different attempts, all revolving around DynamoDB's main method of pagination (as far as i'm aware); utilising "LastEvaluatedKey" and "ExclusiveStartKey:
- Cursor based pagination - I set "Next cursor" to
{{ ddbQueryPlaceholder.data.LastEvaluatedKey }}
and in the query itself I setExclusiveStartKey
to{{ ddbTablePlaceholder.pagination.afterCursor }}
with a limit which matches the page size (100). However, in this scenario the value ofafterCursor
remainsnull
whenever I change page - resulting in the same results being retrieved everytime I change page. It also for some reason limits the pages to 2, even though "Has next page" istrue
and I know there are more results to come. - Limit offset based pagination - I set
ExclusiveStartKey
to be{{ddbQueryPlaceholder.data.LastEvaluatedKey }}
however this results in a dependency cycle error causing the page to crash..
I've tried variations on these two methods but the results are the same - either page changes do not update results, or the page will just crash.