gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.3k stars 10.31k forks source link

"Sorting on fields that need arguments to resolve is deprecated" warning (w/ example repo) #31523

Open rejas opened 3 years ago

rejas commented 3 years ago

Following up on https://github.com/gatsbyjs/gatsby/issues/28565 I created a repo with a sample where this warning occurs:

https://github.com/rejas/deprecate_repo

Description

When building my site I get this warning:

warn The enum value "MdxFieldsEnum.fields___slug" is deprecated. Sorting on fields that need arguments to resolve is deprecated.

Steps to reproduce

Build the example repo https://github.com/rejas/deprecate_repo

Expected result

No warnings should appear

Actual result

Warnings appear

Environment

System: OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa) CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz Shell: 5.0.17 - /bin/bash Binaries: Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node Yarn: 1.22.5 - /snap/bin/yarn npm: 7.11.2 - ~/.nvm/versions/node/v16.1.0/bin/npm Browsers: Chrome: 90.0.4430.212 Firefox: 88.0.1 npmPackages: gatsby: ^3.5.1 => 3.5.1 gatsby-background-image: ^1.5.3 => 1.5.3 gatsby-plugin-feed: ^3.5.0 => 3.5.0 gatsby-plugin-image: ^1.5.0 => 1.5.0 gatsby-plugin-manifest: ^3.5.0 => 3.5.0 gatsby-plugin-mdx: ^2.5.1 => 2.5.1 gatsby-plugin-no-sourcemaps: ^3.5.0 => 3.5.0 gatsby-plugin-offline: ^4.5.1 => 4.5.1 gatsby-plugin-react-helmet: ^4.5.0 => 4.5.0 gatsby-plugin-robots-txt: ^1.6.2 => 1.6.2 gatsby-plugin-sharp: ^3.5.0 => 3.5.0 gatsby-plugin-sitemap: ^4.1.0 => 4.1.0 gatsby-remark-copy-linked-files: ^4.2.1 => 4.2.1 gatsby-remark-images: ^5.2.1 => 5.2.1 gatsby-source-filesystem: ^3.5.0 => 3.5.0 gatsby-theme-material-ui: ^2.0.1 => 2.0.1 gatsby-transformer-sharp: ^3.5.0 => 3.5.0 gatsby-transformer-yaml: ^3.5.0 => 3.5.0

el7cosmos commented 3 years ago

This happens to me also with custom schema. It is weird because without custom schema, the field also need argument to resolve.

Without custom schema, I'm sorting on field with type Date and dateformat extension which receive argument fomatString, fromNow, difference, andlocale, but it builds without deprecation warning. While with custom schema, my field also receive the same argument plus 1 additional argument, then builds throw deprecation warning.

It is getting weirder now, some other fields without custom schema also throw deprecation warning when sorted even if the fields didn't receive any argument at all

yklcs commented 3 years ago

Having the same problem.
I did some digging around in /src/schema/types/sort.ts, and I'm not too sure what's going on.

Looks like fields, childMdx.fields, and childrenMdx.fields are all SORTABLE, yet they have the deprecationReason of "Sorting on fields that need arguments to resolve is deprecated." I can't find any code that should set deprecationReason with depth = 0 for the recursive calls.

phun-ky commented 3 years ago

I'm having the same issue after upgrading to v4, and I find no documentation about this change

satya-nutella commented 3 years ago

Just upgraded to v4, facing the same issue. Any help would be awesome

izackwu commented 3 years ago

Same issue here, no idea how to solve it :(

github-actions[bot] commented 2 years ago

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

anakornk commented 2 years ago

Same issue here on gatsby 4. Any updates?

github-actions[bot] commented 2 years ago

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

phun-ky commented 2 years ago

Issue still persists, need documentation on how to use slug for sorting (or equivalent)

github-actions[bot] commented 2 years ago

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

phun-ky commented 2 years ago

Issue still persist, please reply to this.

fzyzcjy commented 2 years ago

Still have this issue, I am using something like fields___mySlug and it has this warning

mbcod3 commented 2 years ago

graphql shows warning if you use field to sort that was created using gatsby api creatNodeField