[gatsby-source-wordpress]: `options.develop.hardCacheData` does not work if any fields are generated by `createNodeField`
See original GitHub issuePreliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
options.develop.hardCacheData
does not work if any fields are generated by createNodeField
Reproduction Link
https://github.com/tsdexter/gatsbycreatenodefieldhardcachedatarepro
Steps to Reproduce
- clone https://github.com/tsdexter/gatsbycreatenodefieldhardcachedatarepro
npm install
npm run develop
- wait for it to build
cmd+c
(quit thedevelop
process)npm run clean
npm run develop
a second time
Expected Result
Subsequent develop
sessions should build and run
Actual Result
development build fails with error below. Having to turn off this feature really slows down development builds.
Error: Plugins creating nodes can not set data on the reserved field "fields"
as this is reserved for plugins which wish to extend your nodes.
If your plugin didn't add "fields" you're probably seeing this
error because you're reusing an old node object.
Environment
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
Binaries:
Node: 14.20.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.17 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 2.7.8 - /c/Python27/python
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.71)
npmPackages:
gatsby: ^4.0.0 => 4.19.2
gatsby-plugin-image: ^2.0.0 => 2.19.0
gatsby-plugin-manifest: ^4.0.0 => 4.19.0
gatsby-plugin-offline: ^5.0.0 => 5.19.0
gatsby-plugin-react-helmet: ^5.0.0 => 5.19.0
gatsby-plugin-sharp: ^4.0.0 => 4.19.0
gatsby-source-filesystem: ^4.0.0 => 4.19.0
gatsby-source-wordpress: ^6.0.0 => 6.19.0
gatsby-transformer-sharp: ^4.0.0 => 4.19.0
Config Flags
No response
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
createNodeField does not create a field #92 - GitHub
Hi, I am trying to add a field to an existing DatoCMS node but it doesn't work. I have added this code in...
Read more >Using New Gatsby Source WordPress Plugin - CSS-Tricks
This article is not a step-by-step guide on how to use Gatsby Source WordPress Plugin. Again, that's already available in Gatsby's ...
Read more >Error with Gatsby plugin Gatsby-Source-Wordpress
js:68:7 warn The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it? success source and transform nodes - 0.327 s ...
Read more >Sourcing from WordPress - Gatsby
WordPress is a free and open-source content management system (CMS). ... allows a fallback url if WPGRAPHQL_URL is not set in the env,...
Read more >How To Use WordPress Content with a Gatsby.js Application
Thanks to the starter template you used, the gatsby-source-wordpress plugin will already be installed as a dependency and have a settings entry ...
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 Free
Top 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
Hey @tsdexter, thanks for opening this issue.
hardCacheData
is marked as an experimental feature because there are many cases where it doesn’t work properly. In this case I would recommend not using it. For development a more effective way to cut downgatsby develop
start up times is to use the limit optionYou can set a limit to the total number of nodes fetched for each type. Check this example. You can also add a limit for nodes of all types by substituting the typename for
__all
(so instead ofPost
in the example).@LekoArts @TylerBarnes I’ve updated the repro to 4.22.1 and the issue still persists…you can’t run
develop
again untilrm -rf .wordpress-cache
which defeats the purpose of the feature