"Sorting on fields that need arguments to resolve is deprecated" warning
See original GitHub issueDescription
If I create a node field using createNodeField
from a node value:
exports.onCreateNode = async ({node, actions: {createNodeField}}) => {
if (node.internal.type === "MarkdownRemark") {
createNodeField({
node,
name: "template",
value: node.frontmatter.template,
})
}
}
Then I want to use this field to group my nodes
query MyQuery {
allMarkdownRemark {
group(field: fields___template) {
fieldValue
totalCount
}
}
}
There is the following warning
If I use the original data (which is the same), everything is fine
query MyQuery {
allMarkdownRemark {
group(field: frontmatter___template) {
fieldValue
totalCount
}
}
}
Steps to reproduce
- Create a node field
- Try to group nodes by this field
Expected result
No warning, it should works
Actual result
Sorting on fields that need arguments to resolve is deprecated
Environment
System: OS: macOS 11.0.1 CPU: (4) x64 Intel® Core™ i5-4258U CPU @ 2.40GHz Shell: 5.8 - /bin/zsh Binaries: Node: 15.2.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.0.10 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 87.0.4280.88 Firefox: 72.0.2 Safari: 14.0.1 npmPackages: gatsby: ^2.28.0 => 2.28.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:14 (7 by maintainers)
Top Results From Across the Web
"Sorting on fields that need arguments to resolve is ... - GitHub
When building my site I get this warning: warn The enum value "MdxFieldsEnum.fields___slug" is deprecated. Sorting on fields that need arguments ...
Read more >How to resolve this "positional arguments in functional tests ...
DEPRECATION WARNING : Using positional arguments in functional tests has been deprecated, in favor of keyword arguments, and will be removed in Rails...
Read more >Linter rules - Dart
Use the Dart linter to identify possible problems in your Dart code. You can use the linter through your IDE or with the...
Read more >Warning Options - Using the GNU Compiler Collection (GCC)
Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there may have been an...
Read more >Checks | Staticcheck
Checks in this category deal with misuses of the standard library. This tends to involve incorrect function arguments or violating other invariants laid...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The “minimal blog theme” from @LekoArts uses those deprecated sorting fields:
https://github.com/LekoArts/gatsby-themes/blob/ea3eb0b4f6d49c99b2f209d0a9a504f3e3f1ce10/themes/gatsby-theme-minimal-blog-core/gatsby-node.js#L295-L299
I’m curious to hear from @LekoArts what’s the best way to migrate to v3 and avoid those deprecation warnings, while keeping the same functionality.
Thanks 🙏
Will do, thanks anyway!