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
DataStoreSyncExpression failed on Android devices #4535
Comments
Hi @dadaocao, thank you for submitting this issue. We are going to look into it now and get back to you when we have an update, thanks. |
By the way, our team is planning to add web platform to our current project. Does it mean the Datastore strategy should no longer be suitable for our flutter project? |
Hi @MelodyXinyi, Amplify Flutter currently does not support the web platform when using the DataStore category. If web is a requirement, I would suggest exploring if the GraphQL category can fulfill your data needs. Most of the time we see the offline feature (main difference) of DataStore is not a hard requirement and GraphQL is more than enough to solve your business needs. |
If we use GraphQL for web part, does it mean we have to throw away all DataStore configuration for current iOS and Android? |
Hi @MelodyXinyi, unsure what you're referring to as "DataStore configuration". At its core DataStore is built on top of the API category, Amplify Flutter's DataStore uses Amplify Android & Amplify Swift's API implementation, but even those still use the same backend as Amplify Flutter GraphQL. You will be connecting to the same backend so no data is lost, the only change is the API you will interact with the models. Is there specific configuration you are concerned about losing? Also, I'm not sure if you work with the original author of this issue, @dadaocao, if not please open a new issue so we can keep discussion focused. |
Sorry for making you misunderstand, these two accounts both belong to me, so one issue is enough. Thanks for your reply, I understand what you mean. By the way, is there any update about the origin error? Our Android users are still experiencing long-loading time due to the invalidation of SyncExpression. |
@dadaocao, no worries. Can you share the sync expression you are seeing the issue with? |
if (!Platform.isAndroid) {
// userId will be set in _fetchAndSetUserId
// then when Amplify.DataStore.start is called in handleSignedIn, it will use userId to sync data
dataStore = AmplifyDataStore(
modelProvider: ModelProvider.instance,
syncExpressions: [
DataStoreSyncExpression(
User.classType, () => User.ID.eq(appData.userId)),
DataStoreSyncExpression(
Journal.classType,
() => Journal.USER
.eq(appData.userId)
.and(Journal.STAMPSTRING.ge(startString)))
]);
} // Currently, it seems like Android version of DataStore has bug, and we can not use syncExpression on index |
When I ran on Andoird, the following errors will repeat for more than ten times before allowing the user to enter, which cauing long-loading time. Still, there is no problem on iOS.
|
Hi @dadaocao, I was able to confirm this issue and received the "Setting currentState to LOCAL_ONLY" message when running the app on android. We will investigate how to fix this and get back to you with any updates, thank you. |
Thanks, please let me know if you need more info. |
Apologies for the delay. I don't believe we need any other info at this time but we are looking into this and will let you know if we need further info. |
Description
When useing DataStoreSyncExpression to speed up loading time, it turns out that it only takes effect on iOS devices, and Android devices will throw an exception.
Is there a potential bug that I haven't discovered, or is there an alternative way to speed up loading after logging.
Categories
Steps to Reproduce
Setting currentState to LOCAL_ONLY
+No more active subscriptions. Closing web socket.
within a few secondsThis issue is only for Android devices, DataStoreSyncExpression works properly on the iOS devices.
Screenshots
No response
Platforms
Flutter Version
3.3.0
Amplify Flutter Version
1.7.0
Deployment Method
Amplify CLI
Schema
The text was updated successfully, but these errors were encountered: