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

Add level and Parent fields for Categories query #149

Closed
jan-thoma opened this issue Sep 5, 2018 · 9 comments
Closed

Add level and Parent fields for Categories query #149

jan-thoma opened this issue Sep 5, 2018 · 9 comments

Comments

@jan-thoma
Copy link

jan-thoma commented Sep 5, 2018

Add level and Parent fields for Categories query. Especially helpful when creating category navigations

@markhuot
Copy link
Owner

markhuot commented Sep 7, 2018

This should already be possible. Check out,

{
  categories(level:1, ancestorOf:123) {
    #...
  }
}

In the above level is the depth and ancestor takes the entry ID of the parent you're looking for.

@markhuot markhuot closed this as completed Sep 7, 2018
@jan-thoma
Copy link
Author

In the entries query this is possible, that would be cool for categories too, like:

{
  categories(groupId: 1) {
    id
    title
    level
    parent {
      id 
    }
  }
}

If we can retrieve category groups like this it's easy to build nested navigations in js because we know all the relationships we need, without relying on nesting.

@markhuot
Copy link
Owner

markhuot commented Sep 7, 2018

Ah, I see! These new fields are implemented on dev-master. I'll leave this ticket open until it gets a stable release.

{
  category {
    id
    title
    parent {
      id
    }
    children {
      id
    }
    next { id }
    nextSibling { id }
    prev { id }
    prevSibling { id }
  }
}

@markhuot markhuot reopened this Sep 7, 2018
@jan-thoma
Copy link
Author

I will give it try, i switched to dev-master the last day, querys on the dev master took up to 8 Seconds on our server. Is there something to consider when switching the branch?

@markhuot
Copy link
Owner

markhuot commented Sep 7, 2018

Nope, nothing performance wise should have changed. between 1.1.0 and dev-master. You will want to make sure devMode is false though otherwise GraphQL will spend a bunch of time analyzing your schema on each request. That's been there for a while though so it shouldn't vary by branch.

@jan-thoma
Copy link
Author

jan-thoma commented Sep 7, 2018 via email

@BASICjfisher
Copy link

I'm interested in whether this is planned for a release. It would really simplify some things I'm currently working on over the coming weeks and I'd be curious to know about progress.

@mashema
Copy link

mashema commented Dec 6, 2018

Same here, I'm also waiting, do you have a release date?

@markhuot
Copy link
Owner

Closing this issue. The fix is included in version 1.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants