-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[source-drupal] weird behaviour with Drupal entity references when inside a paragraph #19450
Comments
@xaviemirmon I think we're running into a similar issue with paragraph and entity references. Question: Is It seems like this is failing for single value ( |
Ooh @arshad I think you are on to something here. The field itself is yes indeed a single value field. Nested inside a multivalue field. The non-nested field (field_test) is also a single value field though. |
@xaviemirmon I found that if you change the following to
(This is a temporary fix while we figure out what's happening here) |
@arshad This is great! That makes it work! Does anyone know why this couldn't or shouldn't be done this way? Or shall I create a PR with this change? |
I also just ran into this issue and @arshad's suggested change resolved it. |
@jonearley Nice. I created a PR so that we can get some feedback. #19844 |
I suspect this would be a major version change for the plugin. |
@jonearley Yeah let's see what breaks. Go CI :) |
Hey @arshad I found the one fatal flaw in the otherwise perfect plan. 😬 When adding this bit of code, my site broke because multiple nested relationships started having an extra [0] key in the array e.g. |
The plugin behaves as if the entity reference will only be of one type and doesn't account for an entity reference to multiple Drupal content types. This bug blocks my work at the moment. I am considering forking and using the |
Thanks @vladar I'll test this. |
Great. Glad it helped! |
Description
There's some strange behaviour happening with I use an entity reference inside a paragraph with Drupal. I can see the JSON:API is formatting everything as I expect. If I have an entity reference field on its own in a content type Gatsby can see the data and I am able to query values of the reference in my local GraphiQL instance. However, as soon as that is nested inside a reference it just returns
NULL
I've created two fields within my "Page" content type.
field_test
— An entity reference fieldfield_test2
— A paragraph field (entity reference revisions). Inside that field, there is an entity reference field calledfield_embed
which is identical tofield_test
On my content that I am querying, I've referenced the same content. "Travel tip-offs: the best places to visit in August" (Node 56 in Drupal)
Steps to reproduce
Either use my site's data using the following in
gatsby-config.js
or
Add a paragraph field to your content type in Drupal and then add an entity reference field in that paragraph.
Next, running the following query in GraphiQL
Expected result
field_embed
returns the same information asfield_test
Actual result
field_embed
is returningNULL
Environment
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.12.1 - ~/.npm-packages/bin/npm
Languages:
Python: 2.7.15 - /usr/local/bin/python
Browsers:
Chrome: 78.0.3904.97
Firefox: 66.0.5
Safari: 13.0.3
npmPackages:
gatsby: ^2.17.2 => 2.17.2
gatsby-cli: ^2.8.5 => 2.8.5
gatsby-image: ^2.2.29 => 2.2.29
gatsby-plugin-manifest: ^2.2.23 => 2.2.23
gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0
gatsby-plugin-offline: ^2.2.10 => 2.2.10
gatsby-plugin-react-helmet: ^3.1.13 => 3.1.13
gatsby-plugin-sass: ^2.1.20 => 2.1.20
gatsby-plugin-sharp: ^2.2.32 => 2.2.32
gatsby-plugin-styled-components: ^3.1.11 => 3.1.11
gatsby-plugin-typography: ^2.3.15 => 2.3.15
gatsby-source-drupal: ^3.3.0 => 3.3.0
gatsby-source-filesystem: ^2.1.33 => 2.1.33
gatsby-transformer-sharp: ^2.3.0 => 2.3.0
npmGlobalPackages:
gatsby-cli: 2.8.0
The text was updated successfully, but these errors were encountered: