question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CTF-v6: ☂️ Umbrella issue for next major version of gatsby-source-contentful

See original GitHub issue

This umbrella issue collects all information about the upcoming new version of the gatsby-source-contentful plugin.

The core goal of this version is to align the GraphQL schema of the plugin to Contentfuls GraphQL API. These breaking changes allow us to introduce further features and performance improvements as well.

The new schema will be generated based on your content types instead of the existing content. This gives huge benefits in reliability and other things, but requires several rewrites of code, especially on GraphQL query level.

Branching & prerelease

  • This new version will be developed in the feat/contentful-next branch. (It will be created as soon #30855 is ready)
  • PRs for this release will be prefixed with CTF-v6: in the title
  • There is no prerelease yet. Stay tuned.

Breaking changes

  • The first comment contains all steps to migrate your code to this new version. Let me know if something is missing.
  • The second comment highlights the changes to the schema, based on our Contentful e2e test Space

Goals

  • Schema types now will be generated based on the Content Model in Contentful. Your project will no more break when a field has no values at all. (#30855)
  • Align generated schema as close as possible to the Contentful GraphQL API. Queries from both environments should now be able to be more or less copy&pasted. (#30855)
    • JSON fields are now real GraphQL JSON fields. This avoids the There are conflicting field types in your data. warning and allows the JSON data structure to be changed in Contentful without breaking the Gatsby GraphQL Query
    • RichText:
      • Is now a simple object type
      • Fields split up references in entries and assets (#31122)
      • references is now called links and will always be available. This allows querying __typename and data from sys for all links at once as well.
    • Location fields now use a simple object type
    • Keep data from Contentfuls Common resource attributes within the sys property
    • Assets should have meta data like width on top level (#31115)
    • Rename internal types with a scheme that avoids name collisions with content type names (#31286)
  • References for now use the ContentfulEntry interface. This should change depending on the field validation. (Either single type, union or the interface) (#31395) images-contentful) to match new asset structure
  • update typescript typings or migrate to typescript
  • create codemods to help migrating to this new major version (#35113)
  • ~introduce new metadata/tags feature aka the new metadata.tags property~ will be released earlier via #31746
  • Already done in prior release: Remove gatsby-image support #31654

Next action items

Update docs

  • add descriptions to all/most GraphQL fields. Link to Contentful API docs and/or list edge cases like use -1 for max
  • Update plugin readme

Changes in related plugins

Potential performance improvements

  • These changes will reduce the node count which will lead to improvements in bigger projects. (#30855)
  • Rich Text fields no more need to JSON.stringify() and rich text renderer no more needs to JSON.parse() (#30855)
  • We might be able to remove Contentful SDK link resolution and fully rely on our own. This would lead to performance improvements and code simplification (https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-contentful/src/gatsby-node.js#L446-L492) (Fixed in master already via #34561)
  • Reconsider node-per-locale structure, this may lead to massive node count reduction (POC: #31521)
  • All (Long) Text fields still create their own node. As this is a potential performance issue, we should limit the number of fields that get parsed by gatsby-transformer-remark and others. Currently we see these options: a. make it configurable via directives and/or plugin config or b. move markdown in extra field fieldNameMarkdown, we still might need to make it configurable

Examples and test projects

  • update e2e-test/contentful (#30855)
  • update examples/using-contentful (#31270)
  • update benchmarks/contenful
  • ~figure out what to do in packages/gatsby-recipes/src~ Deprecated feature
  • ~update examples/recipe-sourcing-contentful~ [Deprecated feature]

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:8
  • Comments:31

github_iconTop GitHub Comments

3reactions
axe312gercommented, Apr 12, 2022

A small update:

The code mods are taking shape, see progress in #35113

I also discovered a few issues and things that are still to do. See Next action items in the first post.

3reactions
axe312gercommented, Mar 24, 2022

@juanbiberretta This is great!

We currently testing the new version with some projects we got access to. As soon we are happy with the results, we will make a test version available to everyone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-source-contentful
This will disallow the content type name tags till the next major version of this plugin. Learn how to use them at the...
Read more >
gatsby-source-contentful - npm
Gatsby source plugin for building websites using the Contentful CMS as a data source. Latest version: 8.3.1, last published: 11 days ago.
Read more >
graphql - Sort allContentAsset by tag in Gatsby is it possible?
Assuming the interpolation between assets and tags exists (i.e: tags is selectable a field in assets ). If this interpolation is not present...
Read more >
Building Rise of the Robots with Gatsby and Contentful
Paul Scanlon uses Contentful to drive the content for Rise of the ... some actionable know-how you can use in your next Gatsby...
Read more >
Untitled
Dumitru dobrican, Fakhr e alam with bilawal, Big bow phone cases, Razgovor sa gojom ... Monmouth county parks trails, 4 presidents 4 umbrellas...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found