This repository has been archived by the owner on Sep 3, 2021. It is now read-only.
Allow interface type to be used when no fragments #210
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This addresses a bug where querying for an interface type without fragments blows up.
I think this is pretty valid - whilst you sometimes want to query with fragments and thus choose one of the implementations of that interface to query I also think it's very valid to query for just the fields on the interface and not choose to extend it to one of the implementations. This does however require that your node has the label of the interface (otherwise there is no label to query on). But that seems pretty reasonable.
Right now I think this is especially important as there seem to be a few other issues around inline fragment support.
I also note there are a few lines of code around these two that don't seem to do anything. Also that
const implementationName
is just a copy ofinterfaceLabel
at this point. The const on the line below is also seemingly not used. I decided not to do anything with these as I was a bit unsure if they were part of a plan for further interface support. Hope that's OK!Let me know if this needs any more work.
Thanks!