-
Notifications
You must be signed in to change notification settings - Fork 256
observeQuery isSynced value is incorrect after DataStore.clear() #3113
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
Comments
Current work around is to manually wait for the sync process to complete after calling clear. For example: await Amplify.DataStore.clear();
await Amplify.DataStore.start();
await Amplify.Hub.availableStreams[HubChannel.DataStore]!
.firstWhere((event) => event.eventName == "ready"); |
Originally observed in #3054 (comment) |
Hi @Jordan-Nelson I can use Furthermore, I'm using syncExpressions too, so basically if I use this work around, DataStore will keep getting cleared and started multiple times. For an experimental app, I guess that's okay to some extent but for a production app, I think this is a very bad code architecture. Do you have any suggestion on how to do this in a clean way? Is resetting "isSynced" after clearing DataStore an easy fix on your side or it might take time? Thank you! |
UPDATE Awaiting DataStore to be ready is taking ~21 seconds in my application and that's seriously a bad user experience. |
The initial load speed of the datastore is also an issue we are facing. The only way to mitigate it that we found is to use a restrictive Sync Expression, load the base info needed, then reset the Sync Expression to get a full load. Any other suggestion in speeding up the load time ? |
The sync time for DS will depend on how many model types are used, how many models exist, the auth rules you have set up (if any), the selective sync expression used (if any), and of course the internet speed/latency. @jamilsaadeh97 Do you have a use cases that require offline first support, or were there other reasons you chose to use DataStore (opposed to using GraphQL API directly)? We are collecting feedback in #3180 about offline first and caching related use cases as we consider expanding support for these use cases to Web and Desktop. Please feel free to leave feedback there. Even if your use case is mobile specific, it would be good to collect the feedback. @dgagnon - I see you already left feedback and noted that you are specifically looking for offline first support. |
@Jordan-Nelson In my opinion offline first approach is, most of the time, the best approach since it can handle slow internet connections and is fastest when the caching is there. |
Description
The value for
isSynced
returned from observeQuery will be true after callingDataStore.clear()
even while a new sync is in progress.isSynced
should probably reset to false.Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Flutter Version
n/a
Amplify Flutter Version
1.1.0
Deployment Method
Amplify CLI
Schema
No response
The text was updated successfully, but these errors were encountered: