aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.42k stars 2.12k forks source link

DataStore: support pausing/resuming of cloud sync #5037

Open nylki opened 4 years ago

nylki commented 4 years ago

Is your feature request related to a problem? Please describe. If I understand correctly, the DataStore currently always syncs updates immediately to the cloud. This may not be desirable for battery conservation and data usage. We have fullSyncInterval but DataStore will still sync updates in between full syncs.

Describe the solution you'd like I would like the DataStore-API to support a manual cloud-sync functionality, so that the App could for example sync only a few times a day eg. when the device is connected to power.

eg.:

DataStore.configure({
    manualSync: true
})

DataStore.sync()

or, alternatively, when auto-syncing an option to pause auto-syncing:

// When power is low
DataStore.pauseAutoSync()

// user has plugged in power
DataStore.resumeAutoSync()

Describe alternatives you've considered

Not using DataStore, but fetching/sending data via regular graphQL-API and store the Data manually in a storage-api (localstorage, indexedDB and or React-Native's AsyncStorage). This would complicate things, due to mapping different graphQL datatypes to the storage-api, something that DataStore already does.

Additional context If this should be already possible in some way, the documentation should be edited to include the feature.

mdoesburg commented 4 years ago

I need this feature too. Use case:

I am working on an app in which people might be in remote locations (in the jungle, top of a mountain etc.). In the app users have to be able to set if they only want to sync if they are for example on a WiFi network to prevent data charges.

iqaldebaran commented 4 years ago

I need this feature too¡¡¡ Use Case: I am working in an app that have a free function with Datastore locally, and a pay function with cloud storage, and this feature proposed by @nylki is so useful for me.

JPVan commented 4 years ago

I would also love this feature. Both for a free vs paid user scenario, and also to have control over the number of writes to AppSync. In my use case, users edit only their own data, and only view data from other users. This data needs to be updated in the cloud only once per day, but will be entered locally several times a day. It would be nice to save to the cloud once per session, or only once per day.

imoby commented 3 years ago

Please add this!

jtich commented 3 years ago

+1

jacobsapps commented 3 years ago

Bumping this - it's needed badly.

I've got a pre-sign-up flow where users create a bunch of data, which saves locally on a User object without an ID. When signing up, this is copied as a real User object with a UUID, and deleting the placeholder, but sometimes the placeholder syncs to DynamoDB too...

sasweb commented 3 years ago

+1

fizan2904 commented 3 years ago

+1

sallymoon10 commented 3 years ago

+1

nemezisSherokee commented 3 years ago

Hello is the feature now available ?

sacrampton commented 2 years ago

Our use case is for highly intermittent networks - if its on/off/on/off/on.... then the sync is trying to restart over and over again and consumes essentially all of the phone's resources. This leads the app to hang for several minutes and in some cases eventually crash. Our customers are in very remote places that have highly intermittent networks. They are industrial sites that have some network access, but it varies as they walk around the site.

We need to be able to tell DataStore not to try to sync - alternatively, but be able to have it as a lower priority background process that does not overwhelm the application.

emilyahsu commented 2 years ago

Hi all,

I'm Emily, a UX Designer on the AWS Amplify team, and we're conducting user interviews to learn more about the use cases of offline-first vs online-only development modes. The interview will be take at most 30 minutes, and as a “thank you”, we’d love to provide you with $25 in AWS credits for your time.

If you are interested in participating, please email me at emilyhsu@amazon.com and we can schedule a time. Thanks!

jreyesgfi commented 1 month ago

Is there any update regarding this feature?

sacrampton commented 1 week ago

Please remove Stephen Crampton from your mailing list, He passed away this year & I (his wife Megan's) don't have access to his passwords on this platform/website,

Kind regards

Megan

On Mon, 29 July 2024, 7:35 pm jreyesgfi, @.***> wrote:

Is there any update regarding this feature?

— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-js/issues/5037#issuecomment-2255455379, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQROCBW6FYPXWZDFOQHARDZOYEEXAVCNFSM6AAAAABLT4NE6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJVGQ2TKMZXHE . You are receiving this because you commented.Message ID: @.***>