awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
921 stars 266 forks source link

DeltaSync, How to manage Pagination? #428

Open NeillGiraldo opened 5 years ago

NeillGiraldo commented 5 years ago

Note: If your issue/feature-request/question is regarding the AWS AppSync service, please log it in the official AWS AppSync forum

Do you want to request a feature or report a bug? Feature

What is the current behavior? So I have a deltaSync implementation and I have this resolver to list my items

{
  "version": "2017-02-28",
  "operation": "Query",
  "query" : {
      "expression" : "identityId = :identityId",
      "expressionValues" : {
          ":identityId" : $util.dynamodb.toDynamoDBJson($ctx.identity.cognitoIdentityId)
      }
  },
  "filter": #if($filter) $util.transform.toDynamoDBFilterExpression($filter) #else null #end,
  "limit": 100,
}

When I do the Sync call using my delta/Base query, if the expected result is more than 100 items, I only get the first 100 items.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

What is the expected behavior?

The Sync call should allow the user to provide either:

  1. A flag indicating whether the client should keep iterating through pages using the 'nextToken'
  2. A function to indicate how to handle this pagination results.

Which versions and which environment (browser, react-native, nodejs) / OS are affected by this issue? Did this work in previous versions? Not relevant

usmansbk commented 5 years ago

I see a limit of 100 in your query, It's working as expected so your dynamodb response should have a nextToken to paginate the result.