gatsbyjs / gatsby

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

Unexpected data mutation in plugins #19876

Closed vladar closed 3 years ago

vladar commented 4 years ago

Gatsby version 2.18.0 revealed problems in several plugins which mutate data after createNode call. When they do so - mutated fields are not registered by gatsby internal data tracking and are not added to the GraphQL schema.

After gatsby 2.18.5 things work closer to how they did in 2.17.x so those issues are hidden again. But they still exist and must be addressed in every affected plugin. Otherwise, various new features including incremental builds may break.

We should do an audit for data-mutation patterns in plugins, address them (for gatsby own plugins), and help authors of community plugins to fix them too. We should also ensure we don't encourage data mutation practice in our docs.

The list of plugins which are probably affected:

graysonhicks commented 4 years ago

PR to address this in gatsby-plugin-remote-images is here if anyone wants to take a look.

https://github.com/graysonhicks/gatsby-plugin-remote-images/pull/30

graysonhicks commented 4 years ago

👋 gatsby-plugin-remote-images fixed and released in v2.0.0.

antonlvovych commented 4 years ago

Hello 👋🏻 I've faced issue that was mentioned here - https://github.com/gatsbyjs/gatsby/issues/19748

Is there any progress on this issue? Do you need any help?

axe312ger commented 3 years ago

@vladar i think we can ✅ the Contentful issue?

vladar commented 3 years ago

Yup! Thanks for all the work you've put into the plugin to make it happen 👍