-
Notifications
You must be signed in to change notification settings - Fork 28
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
Subscribe is not listening to remote changes even when policy is set to OfflineFirstGetPolicy.awaitRemote #364
Comments
Hey @rutaba1 is your backend GraphQL operation a If you're calling a |
@tshedor It is a subscribe operation and I'm even overriding the
I'm getting an error in console now with no realtime behaviour
I'm printing the values from $TodoFromGraphql function in generated adapter and I'm getting this: Here 1st and 2nd are valid but 3rd is not |
@rutaba1 can you please provide your |
@tshedor Yeah,here is my model
and in
|
@rutaba1 ah, I see. Brick expects the fields you list within the operation to map as top-level properties for the Dart instance fields. For example, the expected Dart model would be @ConnectOfflineFirstWithGraphql(
graphqlConfig: GraphqlSerializable(
queryOperationTransformer: TodoQueryOperationTransformer.new,
))
class Todo extends OfflineFirstWithGraphqlModel {
final String key;
final String event;
final Map<String, dynamic> data;
Todo({
required this.key,
required this.event,
required this.data,
});
} If you want to use the nested properties of @ConnectOfflineFirstWithGraphql(
graphqlConfig: GraphqlSerializable(
queryOperationTransformer: TodoQueryOperationTransformer.new,
))
class Todo extends OfflineFirstWithGraphqlModel {
@Sqlite(unique: true)
@Graphql(fromGenerator: "(data['data'] as Map)['id'] as String")
final String id;
@Graphql(fromGenerator: "(data['data'] as Map)['title'] as String")
final String title;
Todo({
required this.id,
required this.title,
});
} |
@rutaba1 going to close this due to inactivity |
Hi, I have a configured graphql repository for and working fine for all the operations except subscribe. I had set the policy to OfflineFirstGetPolicy.awaitRemote and when I change anything from the backend the listener is not getting triggered. It triggers only If I do any CRUD operation from the frontend.
Here is the code for my Repository set up
And here is the UI where I'm trying to listen to the stream
I have also noticed that in initState function I have to call get function to hydrate the local database the stream subscription is not doing it on it's own.
The text was updated successfully, but these errors were encountered: