gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

[gatsby-plugin-wordpress] 'WPGraphQL menu data' not merging properly with the 'Gatsby schema & Node model' #29830

Closed Srishtichambail closed 3 years ago

Srishtichambail commented 3 years ago

Description

WPGraphQL menu data not merging properly with the Gatsby schema & Node model. Not able to see menu data when querying allWpMenu or allWpMenuItem. Menu items are visible in Wordpress GraphiQL IDE but not in Gatsby GraphiQL IDE.

Steps to reproduce

// This is a simple debugging tool // dd() will prettily dump to the terminal and kill the process // const { dd } = require('dumper.js')

/**

const createAllSitePages = async (gatsbyUtilities) => {

const pageTemplate = path.resolve('./src/templates/page.js') const pages = await gatsbyUtilities.graphql(' { allWpPage { edges { node { id title content slug } } } } ') return Promise.all( pages.data.allWpPage.edges.map(edge => { console.log('page created:', edge.node.title, edge.node.slug); gatsbyUtilities.actions.createPage({ path: '/${edge.node.slug}/', component: pageTemplate, context: { title: edge.node.title, }, }) }) ) }

/**

/**

async function getPosts({ graphql, reporter }) { const graphqlResult = await graphql(/ GraphQL / ' query WpPosts {

Query all WordPress blog posts sorted by date

  allWpPost(sort: { fields: [date], order: DESC }) {
    edges {
      previous {
        id
      }

      # note: this is a GraphQL alias. It renames "node" to "post" for this query
      # We're doing this because this "node" is a post! It makes our code more readable further down the line.
      post: node {
        id
        uri
      }

      next {
        id
      }
    }
  }
}

')

if (graphqlResult.errors) { reporter.panicOnBuild( 'There was an error loading your blog posts', graphqlResult.errors ) return }

return graphqlResult.data.allWpPost.edges }

- menu query

allWpMenu { edges { node { menuItems { nodes { label } } } } }



### Expected result

Query should return all menu items

### Actual result

No menu item is returned

### Environment

System:
    OS: Windows 10 10.0.18362
    CPU: (4) x64 Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz
  Binaries:
    Node: 12.18.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.15 - /c/Users/Srishti/.windows-build-tools/python27/python
  Browsers:
    Edge: Spartan (44.18362.1.0)
  npmPackages:
    gatsby: ^2.30.1 => 2.32.2
    gatsby-image: ^2.9.0 => 2.11.0
    gatsby-plugin-manifest: ^2.10.0 => 2.12.0
    gatsby-plugin-offline: ^3.8.0 => 3.10.0
    gatsby-plugin-react-helmet: ^3.8.0 => 3.10.0
    gatsby-plugin-sharp: ^2.12.0 => 2.14.1
    gatsby-source-filesystem: ^2.9.0 => 2.11.0
    gatsby-source-wordpress: ^4.0.3 => 4.0.3
    gatsby-transformer-sharp: ^2.9.0 => 2.12.0
  npmGlobalPackages:
    gatsby-cli: 2.19.2
Srishtichambail commented 3 years ago

Any update on this?

github-actions[bot] commented 3 years ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] commented 3 years ago

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜