angel-dart / angel

[ARCHIVED] A polished, production-ready backend framework in Dart for the VM, AOT, and Flutter.
https://angel-dart.dev/
MIT License
1.06k stars 67 forks source link

Subscription returns null only #199

Closed thosakwe closed 3 years ago

thosakwe commented 4 years ago

This issue was originally created by @fusion44 here, before being automatically moved: https://github.com/angel-dart-archive/graphql/issues/41


Hi!

While writing a graphql subscription with angel-graphql I might have found a bug. When I subscribe to subscribeSetupStatus the returned value is always null.

My subscription gql:

subscription {
  subscribeSetupStatus {
    finished
    state
    progress
  }
}

What my resolve function returns:

{
  finished: false, 
  state: 1, 
  progress: 0.01
}

I've traced the problem to: https://github.com/angel-dart/graphql/blob/d5593659fe742358a573eb6c09b7132d89efdcbf/graphql_server/lib/graphql_server.dart#L479 The Map from above is passed into the resolveFieldValue<T> method with the arg T objectValue. The fieldName arg is always subscribeSetupStatus, so I suspect that a method beforehand doesn't extract the correct field names from the subscription as 'finished', 'state' or 'progress' are never passed to this method.

Fetching the same data via a query works.

I'm using the use-gql-branch at commit d559365 locally (not from pub). Though, I found the same behaviour in latest stable.

Thank you!

thosakwe commented 4 years ago

@thosakwe commented:

Thanks for reporting! I'll take a look later on today.