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

Duplicate node + deprecated method warning on npm run start #3

Open
ViolanteCodes opened this issue Dec 7, 2022 · 1 comment
Open
Assignees

Comments

@ViolanteCodes
Copy link
Contributor

ViolanteCodes commented Dec 7, 2022

see video: link

Note: I think we can ignore the first error - it seems to only show up when API token is not set correctly. :) so just the deprecation warning.

@prokopsimek
Copy link
Collaborator

@ViolanteCodes

see video: link

Note: I think we can ignore the first error - it seems to only show up when API token is not set correctly. :) so just the deprecation warning.

All addNode functions are used correctly according to the Gridsome documentation.

The addNode function has some property fields that might be somehow used for built-in GraphQL.

collection.addNode(options)

- options ObjectRequired.
- id stringA unique id for this collection.
- ...fields objectCustom fields.

ref.: https://gridsome.org/docs/data-store-api/#collectionaddnodeoptions

See this deprecation notice in Gridsome source code: https://github.com/gridsome/gridsome/blob/149dbff92d8ea612553e7479991f2b43e4a903dd/gridsome/lib/store/Collection.js#L66-L69

The deprecation warning is due to data. The data returned from ButterCMS contains the fields attribute and it causes this deprecation warning because for the page data, the fields are part of the page data and not some specific data for the addNode function.

There are 3 ways to remove the deprecation notification:

  1. Put the page data into another attribute or rename the fields attribute from ButterCMS, e.g. buttercmsFields. It will be necessary to write additional custom code in the starter to pick the right attributes from data.
  2. Remove the deprecation notices with --no-deprecation or --no-warnings command-line flags (source: https://nodejs.org/api/util.html#util_util_deprecate_fn_msg_code) but it suppress all warnings for the starter.
  3. Just ignore it. :D

What do you think is the best solution?

@prokopsimek prokopsimek self-assigned this Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants