0

I have a Gatsby site deployed to netlify. In development mode I set the option watchMode:true of gatsby-source-sanity in gatsby-config.js and this works fine to watch sanity studio for changes but in production it does not. I have tried adding a token and toggling the watchMode between true and false. The only way I see changes in production is to re build my site on Netlify

1 Answers1

3

watchMode is only relevant when developing. Netlify hosts a static build from Gatsby, so the only way to get new Sanity content in production it to rebuild (or fetch content on the client, but probably not what you want in this case).

You can create a webhook that will fire when content is updated in Sanity that can trigger a new build in Netlify. Example from Sanity docs.

corygibbons
  • 401
  • 3
  • 8
  • 1
    Thanks a lot, solves my problem. Gatsby build cache plugin is also great to optimize each build. Incase you want to use less build minute. – Inioluwa Sogelola Jan 04 '21 at 20:43