You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SnippetObjectType is implemented as a union of a project's registered snippet models. Unless the snippet classes themselves implement a field that can discriminate the specific type of a snippet instance, it can be difficult to determine which type of snippet you have in a client.
For example, if using a stream field with SnippetChooserBlock, I might query it as follows:
The issue then is determining exactly which snippet type I get in response. I could query __typename on SnippetObjectType, but this won't work in environments where introspection queries are forbidden.
To get around this in my project we've added our own snippet interface type, which has a snippetType field, which returns the snippet class name. Something similar would be a valuable addition to grapple.
The text was updated successfully, but these errors were encountered:
SnippetObjectType
is implemented as a union of a project's registered snippet models. Unless the snippet classes themselves implement a field that can discriminate the specific type of a snippet instance, it can be difficult to determine which type of snippet you have in a client.For example, if using a stream field with
SnippetChooserBlock
, I might query it as follows:The issue then is determining exactly which snippet type I get in response. I could query
__typename
onSnippetObjectType
, but this won't work in environments where introspection queries are forbidden.To get around this in my project we've added our own snippet interface type, which has a
snippetType
field, which returns the snippet class name. Something similar would be a valuable addition tograpple
.The text was updated successfully, but these errors were encountered: