-
Notifications
You must be signed in to change notification settings - Fork 200
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
Re-evaluate expressions at runtime issue #3383
Comments
Hi @kubatatami, thanks for opening this issue. The team will take a look and post here once we have an update. |
Hi @kubatatami, |
@5d Yes. Let's say we have a user with data from the last few months. User signs in and I want to let him use the app once the app synced data from the last 24h. Then I want to re-evaluate expressions to sync rest of data. |
@kubatatami Thanks for confirming. Therefore, the desired behavior is to preserve the data filtered by the previous predicate and apply the new predicate exclusively to the newly generated data upon triggering a restart on the datastore. |
@5d @ruisebas I was also thinking about different strategy to observe syncing progress and let users use the app once the app synced data from the last 24h but I noticed that |
Please try out the fix in |
Hey @lawmicha fix in |
Hi @kubatatami, thanks for trying out the fix and letting us know.
We don't expose a way to change the sort order for the Sync Query API call performed internally but that sounds like it might be possible and would not impact the integrity of the data. What are some use cases you have in mind for sorting by newest to oldest? Is it so that you will display the most recently created/updated items first and let the oldest items eventually come in? |
@lawmicha Yes, exactly. Now on |
This has been released in https://github.com/aws-amplify/amplify-swift/releases/tag/2.25.1 |
|
Describe the bug
We are trying to optimize syncing process in our app. We try to sync only limited amount of data using sync expressions. Later in runtime we modify properties to always return
QueryPredicateConstant.all
and we try to resync by stop-start as described in documentation(In order to have your expressions re-evaluated, you can execute Amplify.DataStore.clear() or Amplify.DataStore.stop() followed by Amplify.DataStore.start().
)Unfortunately it doesn't work as expected. New data will not show up in the app until you call
Amplify.DataStore.clear()
. The only workaround we found is setsyncInterval
to 0 what always force a fullSync but it's a bad solution for other reasons. It looks like deltaSync doesn't support changes in sync expressions. I found a PR with possible solution but there are no updates since February.Steps To Reproduce
Expected behavior
Re-evaluate expressions at runtime should work as described in documentation. Calling
Amplify.DataStore.stop()
andAmplify.DataStore.start()
should re-evaluate expressions and pull new data.Amplify Framework Version
2.22.0
Amplify Categories
DataStore
Dependency manager
Swift PM
Swift version
5.9
CLI version
12.7.1
Xcode version
15.0.1
Relevant log output
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
all
Device
all
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: