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

syncExpression doesn't support lists #1509

Open
1 task done
PS-MS opened this issue Sep 24, 2021 · 1 comment
Open
1 task done

syncExpression doesn't support lists #1509

PS-MS opened this issue Sep 24, 2021 · 1 comment
Labels
datastore DataStore category/plugins feature-request Request a new feature

Comments

@PS-MS
Copy link

PS-MS commented Sep 24, 2021

Before opening, please confirm:

Language and Async Model

Kotlin

Amplify Categories

DataStore

Gradle script dependencies

// Put output below this line

Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

https://docs.amplify.aws/lib/datastore/sync/q/platform/android/#selectively-syncing-a-subset-of-your-data

Describe the bug

We are using group authorisation and as AppSync doesn't support dynamic group authorisation, and tells every device when something has been created/updated/deleted despite group settings, I tried to add in the following syncExpression:

.syncExpression(***::class.java) { ***.GROUP.contains("3bd49a54-cb68-454c-860e-d06d7dc1bd0f") }

GROUP being a list of strings, but on running the app the expression fails with:
java.lang.IllegalArgumentException: group field inside provided object cannot be evaluated by the operator type: CONTAINS

Reproduction steps (if applicable)

Attempt to use a syncExpression for a QueryField that is a List<*>

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@changxu0306 changxu0306 added datastore DataStore category/plugins bug Something isn't working labels Sep 24, 2021
@raphkim raphkim added feature-request Request a new feature and removed bug Something isn't working labels Sep 30, 2021
@PS-MS
Copy link
Author

PS-MS commented Oct 25, 2021

I've run into another issue that this is very similar to, probably the same. In the below code example the condition is true, and the data is saved locally but the change doesn't sync to dynamoDB.

suspend fun testSave() {
    val userObj = UserDao().getCurrentUser()
    userObj?.let {
        val updatedUser = userObj.copyOfBuilder()
            .givenName("Sam")
            .build()
        try {
            KotlinAmplify.DataStore.save(
                updatedUser,
                User.GROUP.contains("955e8da2-9197-4f3f-ad46-f2d4556428ec")
            )
            Log.i(TAG, "testSave: all good, saved")
        } catch(dse: DataStoreException) {
            Log.e(TAG, "testSave: ${dse.localizedMessage}")
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore DataStore category/plugins feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

3 participants