-
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
Add ability to sort groups #3684
Comments
We have the ability to sort and filter in GraphQL as the docs specify: https://www.gatsbyjs.org/tutorial/part-four/#build-a-page-with-a-graphql-query However we need more information on this so I've opened a PR to add additional info: |
@KyleAMathews Ah, yeah. Hmmm, perhaps I mean edges? Let me explain what I am trying to do... I am trying to group my pages into sections, and in those sections have an order (for a menu). The query I am using is: {
allJsFrontmatter {
group(field: data___section) {
fieldValue
edges {
node {
menuLabel,
positionInSection,
}
}
}
}
} This correctly groups by I can of course post-process the result of the query and sort...but I feel like I am missing something obvious here at the GraphQL layer. After looking around this may actually be related to #3190 ? |
Gatsby's GraphQL layer is custom to Gatsby so there's missing features and you ran into one of them :-) I think it makes a lot of sense for items in groups to respect the sort (and filter, skip, and limit?) arguments passed to the connection. I'd love a PR adding this! This is where we resolve the groups
|
Excellent, I'll take a look into putting up a PR...thanks for the quick response! |
Would love to see this too. |
Any updates on this issue? Ran into the same use case today |
Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help! |
Feature request: ability to sort groups
It appears there is no way to specify the sort order of groups: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/build-connection-fields.js#L97
The text was updated successfully, but these errors were encountered: