Posted On: Jan 14, 2021
With the recent Amplify Library release, Amplify DataStore gains the ability to selectively sync a subset of your app data and to sort your app data. DataStore provides frontend web and mobile developers a persistent on-device storage repository for you to write, read, and observe changes to data even if you are online or offline, and seamlessly sync to the cloud as well as across devices.
DataStore customers can now choose to sync only a subset of their app data to the local device. Selective sync enables you to personalize the DataStore sync behavior to each app user. For example, given a table with song names and genre, DataStore can selectively sync only songs from the user’s preferred genre. By syncing only the data that the end-user needs, developers can also optimize their app’s network traffic. If you’re building a multi-tenant application, you can choose to sync only data based on a logged-in user’s preference information. The selective sync capability can be reconfigured during runtime on-the-fly in response to events such as a user login or logout. For cost optimization, selective sync can utilize DynamoDB indexes by applying query predicates to the operation when available.
You can now also use Amplify DataStore to sort your app data in ascending or descending order. You don’t need to make any additional changes to your app’s GraphQL API schema to take advantage of data sorting. All sorting operations are handled locally and can be done on any field of the data model, irrespective of the DynamoDB index.