Open
Description
Description
I'm experiencing an issue with Amplify DataStore in a Flutter application. The main models (Share and OperationMode) are syncing correctly, but the automatically generated join table for a many-to-many relationship (ShareOperationMode) is not syncing to the device.
Here is the schema:
type Share @model @auth(rules: [{ allow: private, ownerField: "pOwner" }]) {
id: ID!
// ... other fields ...
operationModes: [OperationMode] @manyToMany(relationName: "ShareOperationMode")
pOwner: String!
}
type OperationMode @model @auth(rules: [{allow: private}]) {
id: ID!
// ... other fields ...
shares: [Share] @manyToMany(relationName: "ShareOperationMode")
}
Here is the syncExpressions:
final syncExpressions = [
DataStoreSyncExpression(Share.classType,
() => Share.POWNER.eq(prefs.getString('userId') ?? '')
.or(Share.POWNER.isOneOf(prefs.getStringList('friendIds') ?? []))
),
DataStoreSyncExpression(OperationMode.classType, () => QueryPredicate.all),
];
Categories
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
- Add selective sync to Share model
- Install app
- Wait for sync to complete. After initial syncing, I run DataStore.close() to stop so sync expression can be loaded again to load records owned by user's friends
- Share and OperationMode sync correctly, but ShareOperationMode does not sync and is left with zero records.
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.24.0
Amplify Flutter Version
2.4.1
Deployment Method
Amplify CLI (Gen 1)
Schema
No response