graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

@defer on EF nav prop causes null results in query

Open Arrivegrsmith opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

class Query { [UseDbContext(typeof(SomeContext))] public IQueryable<Foo> GetFoos(SomeContext ctx) { return ctx.Foos(); } } class Foo { Bar[]? RelatedBars { get; set; } } class Bar { }

query Foos { id ... @defer { RelatedBars { ... } } }

Returns null results for RelatedBars field. Since @defer is allowed on the navigation property, we should support @defer on those projected EF nav props. Possible solutions:

  • Ignore @defer on an EF projection for a nav prop and return query results immediately
  • Create a separate query on those EF nav props - maybe EF supports async nav queries?
  • Return a developer error indicating that this is a nav prop and does not support @defer

Steps to reproduce

Repro details in description.

Relevant log output

No response

Additional Context?

No response

Product

Hot Chocolate

Version

13.0.0-preview.47

Arrivegrsmith avatar Sep 10 '22 17:09 Arrivegrsmith

Bug ticket doesn't explain that field RelatedBars is the one-to-many nav prop in EF's configuration. Clarifying here.

Arrivegrsmith avatar Sep 12 '22 14:09 Arrivegrsmith