faustjs icon indicating copy to clipboard operation
faustjs copied to clipboard

Is it possible to write GQty queries directly as we could do with apollo?

Open Pritha-Roy opened this issue 4 years ago • 4 comments

In my project I need the data structured in a particular way which is currently not achievable by client.useQuery() . I was thinking, if I had a way to write the query diretly, it would save time. DO we have any such option in Faust GraphiQL client?

Pritha-Roy avatar Nov 22 '21 14:11 Pritha-Roy

@Pritha-Roy This is currently not possible in Faust.js. Could you provide an example of a type of query you are looking to make that is not supported?

blakewilson avatar Dec 03 '21 15:12 blakewilson

Thank you @blakewilson for the reply. In my project, the header menu consists of 3 levels on menu. I Mean Header menu -> parent menu -> child menu. The query I've written in my project in faustjs is,

const links = menuItems({
    first: 100,
    where: { location: MenuLocationEnum.PRIMARY, language: "en" },
  }).nodes;

but ideally the structure I'm looking for is returned by the following gql.

query MyQuery {
  menuItems(first: 100, where: {location: PRIMARY, language: "en", parentId: ""}) {
    nodes {
      label
      id
      url
      childItems {
        edges {
          node {
            id
            label
            childItems {
              nodes {
                id
                label
              }
            }
          }
        }
      }
    }
  }
}

Can you please suggest how to implement this?

Pritha-Roy avatar Dec 06 '21 10:12 Pritha-Roy

Moreover I've also noticed, for footer menu even if I'm calling the correct location, it's always returning me the header menu nodes.

const links = menuItems({
first: 100,
where: { location: MenuLocationEnum.FOOTER_MENU, language: "en" },
}).nodes;

Pritha-Roy avatar Dec 06 '21 11:12 Pritha-Roy

@Pritha-Roy We are preparing a new version of Faust (called temporarily FaustNX) which uses Apollo client instead of GQty. That way you will be able to perform custom queries over there.

theodesp avatar Aug 24 '22 08:08 theodesp

@Pritha-Roy we have a new version of Faust that uses Apollo client instead of GQty. So now you can include your own custom queries. We are updating our documentation site, showing how to use it.

I will close this ticket now. Thank you.

theodesp avatar Oct 19 '22 09:10 theodesp