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

doesn't handle resolveType that returns a promise

Open benawad opened this issue 5 years ago • 7 comments

For abstract types, graphql-js handles resolveType if it's a promise https://github.com/graphql/graphql-js/blob/e590dd2b6f1d05085fbb057fe357be957378bcfb/src/execution/execute.js#L967

graphql-jit currently does not https://github.com/zalando-incubator/graphql-jit/blob/master/src/execution.ts#L896

this normally wouldn't cause a problem because most people don't return a promise from resolveType, but type-graphql converts all resolveTypes to return promises so I'm running into this.

benawad avatar Jan 08 '20 23:01 benawad

Thanks for the issue.

While there are plans to address these limitations, I would also explore removing this behavior from type-graphql, those redundant promises do add overhead and prevent v8 optimizations.

ruiaraujo avatar Jan 09 '20 01:01 ruiaraujo

Yep already done, just wanted to let you know in case you haven't run across this edge case.

benawad avatar Jan 09 '20 03:01 benawad

I have the same problem. is there a solution other than forking type-graphql?

redmundas avatar Apr 22 '20 19:04 redmundas

Hello! We're using this library and have a use case in which we would like to resolve the type of some interfaces asynchronously. @ruiaraujo, do I understand you correctly that this is something you would like to support (regardless of the redundant type-graphql case)? Can you already say if this is something in the near or distant future?

ChristianBoehlke avatar Aug 27 '20 14:08 ChristianBoehlke

Does the library now support resolving the type of some interface asynchronously?

kaushik143 avatar Jan 12 '21 10:01 kaushik143

Any updates on this issue?

PabloSzx avatar Jan 31 '21 01:01 PabloSzx

Looks like isTypeOf also does not support promises

hayes avatar Feb 11 '22 23:02 hayes