question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Sorting on fields that need arguments to resolve is deprecated" warning

See original GitHub issue

Description

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 Screenshot 2020-12-09 at 17 19 30

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

  1. Create a node field
  2. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
emmenkocommented, Mar 6, 2021

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 🙏

0reactions
rejascommented, May 21, 2021

Will do, thanks anyway!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found