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

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

Open
rejas opened this issue May 21, 2021 · 12 comments
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@rejas
Copy link

rejas commented May 21, 2021

Following up on #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

@rejas rejas added the type: bug An issue or pull request relating to a bug in Gatsby label May 21, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 21, 2021
@vladar vladar added topic: GraphQL Related to Gatsby's GraphQL layer and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 21, 2021
@vladar vladar self-assigned this May 21, 2021
@el7cosmos
Copy link

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
Copy link
Contributor

yklcs commented Aug 6, 2021

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
Copy link

phun-ky commented Nov 5, 2021

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

@satya-nutella
Copy link

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

@izackwu
Copy link

izackwu commented Nov 26, 2021

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

@github-actions
Copy link

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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Dec 16, 2021
@anakornk
Copy link

Same issue here on gatsby 4. Any updates?

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Dec 21, 2021
@github-actions
Copy link

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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jan 10, 2022
@phun-ky
Copy link

phun-ky commented Jan 10, 2022

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

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Jan 11, 2022
@github-actions
Copy link

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! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jan 31, 2022
@phun-ky
Copy link

phun-ky commented Jan 31, 2022

Issue still persist, please reply to this.

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 1, 2022
@LekoArts LekoArts added the status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. label Feb 1, 2022
@fzyzcjy
Copy link

fzyzcjy commented Feb 4, 2022

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

@mbcod3
Copy link

mbcod3 commented Mar 3, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests