Skip to content
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

field_[fieldname]_string disappears from graphql when resolving relation #620

Open
1 task done
stylesuxx opened this issue Feb 27, 2024 · 2 comments
Open
1 task done
Labels
pending-author [Issue] Add Storyblok employee pending-triage [Issue] Add labels to describe it or prioritise it

Comments

@stylesuxx
Copy link

Describe the issue you're facing

This is probably more a question than a bug report, but you don't have a matching template for that, so I'll just go ahead here - sorry.

I have a content called news. Within this I have a field referencing a category. When inspecting it with graphql explorer I can see the ID of the referenced category by requesting the field field_category_string:

query {
  allStoryblokEntry(
    filter: {
      field_component: { eq: "news" }
    }
  ) {
    edges {
      node {
        name
        uuid
        field_category_string
      }
    }
  }
}

Now, if I ask gatsby-source-storyblok to resolve this relation:

...
{
  resolve: 'gatsby-source-storyblok',
  options: {
    resolveRelations: [
      'news.category',
    ],
},
...

the relation gets resolved as expected but the field_category_string disappears as an option from graphql. This is very unfortunate since I need the category to query for news withing this category.

Or to re-phrase the question: How can I resolve relations and allow the entities to be filtered by such a resolved relation?

Reproduction

sorry...

Steps to reproduce

No response

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
    Memory: 13.34 GB / 46.97 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.9.0/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  Browsers:
    Brave Browser: 121.1.62.156
    Chrome: 121.0.6167.139
  npmPackages:
    gatsby: ^5.12.4 => 5.12.11

Used Package Manager

yarn

Error logs (Optional)

No response

Validations

@stylesuxx stylesuxx added pending-author [Issue] Add Storyblok employee pending-triage [Issue] Add labels to describe it or prioritise it labels Feb 27, 2024
@joakimmillen
Copy link

Shouldn't you just be able to get that information from the resolved relation then instead?

@stylesuxx
Copy link
Author

Thank you! Could you maybe provide an example of how I would filter the entities based on the values of a resolved entity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-author [Issue] Add Storyblok employee pending-triage [Issue] Add labels to describe it or prioritise it
Projects
None yet
Development

No branches or pull requests

2 participants