Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feedback] Datastore does not start synching with the cloud until operation is taken #1795

Closed
onlybakam opened this issue May 20, 2020 · 4 comments
Labels
amplify/js Issues tied to JS

Comments

@onlybakam
Copy link
Contributor

Page: /lib/datastore/sync/q/platform/js

Feedback:

the page insinuates that simply following instructions will start synching data with the AppSync backend. that is not correct. synching only starts after an op is done:

https://github.com/aws-amplify/amplify-js/blob/e71fee58bdd940f5fbcd4268f08f53e2b85168bd/packages/datastore/src/datastore/datastore.ts#L798

really important distinction for customers building multi screen applications and/or components started dynamically.

@jordanranz jordanranz added the amplify/js Issues tied to JS label May 22, 2020
@swaminator
Copy link
Contributor

@onlybakam "synching only starts after an op is done" What do you mean by this? If a developer starts locally, and then runs npm run amplify-push that syncs the data the cloud.

@onlybakam
Copy link
Contributor Author

for the client: sync engine is initiated when start() is called. start() is not called in configure(). so unless user does a query/save/observe, no synchronization will happen.

this might sound like an odd thing. but there might be a situation where Amplify is initialized in a top level view/page but no Datastore CRUD operation is taken until user navigates to another view. we should be clear that if you want data to start synching right away, you should call Datastore.start(). (the function is now public. it wasnt when i first opened the issue)

@ericclemmons
Copy link
Contributor

That's a good point. Maybe this is a feature request request to improve upon this PR:

aws-amplify/amplify-js#5942

So the expectation would be kicking off start() when DataStore is configured?

@mauerbac
Copy link
Member

mauerbac commented Jul 8, 2020

Hi @onlybakam --

I see your concern. Datastore.configure is similar to amplify.configure in that i has the config data which will be used when an API is called. When you use datastore operations like .save(), .query(), .observe() or .remove() the config is used and synced to the backend. Currently, this doesn't happen when .configure is called but rather on an API call due to the amount of data involved -- this can slow an app. Will close this as I believe this is explained. If i'm missing something, please ping this thread.

@mauerbac mauerbac closed this as completed Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
amplify/js Issues tied to JS
Projects
None yet
Development

No branches or pull requests

5 participants