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
Resolve Promise
references for interface types before handing off to resolveType
fn
#2556
Resolve Promise
references for interface types before handing off to resolveType
fn
#2556
Conversation
🦋 Changeset detectedLatest commit: 5a1b8a2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for apollo-federation-docs canceled.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think this is the issue and the fix looks good to me.
Testing wise, I'll note that there is few variants on how you can make this work: you can skip the __resolveType
but return the __typename
in the __resolveReference
instead, or you can use isTypeOf
for instance, and those variants are tested here, but indeed only for there synchronous versions. It might be nice to try to modify this (parameterised) test to include asynchronous variants of the various options. In particular, the added test in this patch tests an async __resolveReference
but a sync __resolveType
, but you can also have async __resolveType
(with or without async __resolveReference
), and while I believe the code is fine for those now, would be nice to cover everything.
3c65af6
to
c437d6e
Compare
Fixes #2552
Commits in order first reproduce the issue then resolve it.
Interface entities are a relatively new thing, but I'm surprised this hasn't surfaced yet since it seems like it'd be a showstopper for anyone trying to use it. If my understanding of the issue is correct, this seems like a reasonable solution... though it's possible the issue is wrong.
FWIW, none of our
__resolveReference
functions in tests returnPromise
s, it might be more realistic if they did.