-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feat: a way to avoid certain references #25
Comments
I tried to make my idea to work, but it looks like it's too much of work. And the result would look like a hack (in comparison with the current toolkit code). I think it should be easier for me to adjust the Drupal's schema. I mean switch to GraphQL module version 4 and write custom schema/resolvers. |
Hey, I did a draft of the drupal sourcing using the toolkit here: https://github.com/vladar/gatsby-source-drupal-graphql But it does create a separate node for each translation using a fragment like this for id: fragment MyIdFragment on SomeDrupalType {
__typename
entityId
entityLanguage {
id
}
} |
Oh! I thought that the ID fragment should have So I guess this issue can be closed? BTW, we switched our Drupal Gatsby Toolkit prototype to GraphQL module version 4. And we won't go back to v3 🙂 Here is why: https://github.com/AmazeeLabs/silverback-mono/tree/development/apps/silverback-drupal#why-not-version-3-of-drupal-graphql-module |
We had to update the toolkit to support nested fields in id fragments (as it turned out to be useful). You can use as many fields as needed for gatsby ids. But keep in mind that for "delta sourcing" you will need to provide all of the id fields and a proper |
Problem/Motivation
I was experimenting with Drupal. In most cases the toolkit was just working, which is super cool. Thanks for the great work!
Now I met the first issue when tried to add content translation support. In Drupal, content translations aren't separate entities, they don't have own IDs, just language codes differ. The idea was to fetch all translations of a Drupal entity into a single Gatsby node. However, in Drupal schema, a content entity and it's translations have the same GraphQL type.
Probably better to explain with screenshots :)
Here is my original fragment:
Both
entities
andentityTranslations
fields have[NodeArticle]
type. The toolkit's sees theentityTranslations
type and replaces the original fields with a reference. This leads to two things:entityTranslations
field's sub-fields are moved toentities
field.NODE_
queries. Drupal serve all of them in the default language.Proposed resolution
Add something like
@noReference
directive:Does this proposal sound good?
The text was updated successfully, but these errors were encountered: