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.

[gatsby-source-contentful] Allow for cached content whenever possible

See original GitHub issue

Hi, this is my first issue, I could not find duplicates but sorry in advance if it exists. Also, thank you for a great plugin.

Summary

Allow for something like GATSBY_CONTENTFUL_OFFLINE=prefer which always uses cached data (if exists) in development

Motivation

I’m working on a project with a pretty large amount of contentful data. Having contentful data completely synced all the time is not a priority for my use case, so I would like a way to (at least attempt to) manually opt out of contentful re-sync whenever I add a dependency, change a gatsby-*.js file, etc.

It will considerably speed development time for me. Hope this is possible.

Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerBarnescommented, Dec 11, 2019

Hey @doronnac , thanks for the feature request! This would actually be a Gatsby core feature, not specific to the contentful plugin, and this is not currently possible. Right now, the entire cache for all plugins is invalidated if gatsby-*.js files or dependencies are changed, regardless of wether it’s needed or not. Work is currently being done to selectively invalidate the cache of only the plugins that need it, see https://github.com/gatsbyjs/gatsby/pull/8379. Once that’s merged though, it wont solve your problem. IMO we need a gatsby-node API for plugins to run logic to decide if their cache (or parts of their cache) should be invalidated.

1reaction
mueschacommented, Dec 12, 2019

@doronnac maybe then should help an external cache/proxy/vcr for your test setup?

something like the “famous” VCR ruby gem i found (but not tested):

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-source-contentful
Make sure to regularly clean your cache when using Contentful's preview API. The following content type names are not allowed: entity , reference....
Read more >
How to set GATSBY_CONTENTFUL_OFFLINE flag when ...
I tried to run the setting GATSBY_CONTENTFUL_OFFLINE=true to see if the site can be served from cache. Where to add this line in...
Read more >
Developer Showcase Spotlight: Gatsby Bricks for LEGO builders
Gatsby Bricks is a a hobby project made with Contentful and Gatsby to showcase LEGO creations made by Dan Polant and his family....
Read more >
How to setup Gatsby with Contentful CMS and Deploy on Netlify
If you have been working with a Gatsby blog site, you'd most likely know how to ... The gatsby-source-contentful allows us to pull...
Read more >
5 Optimizations to Get Faster Gatsby Builds Today - Netlify
Most build systems, including Netlify, don't keep the Gatsby cache by default. However, you can install the Gatsby Cache Netlify Build Plugin to ......
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