I have my Gatsby site data in json files. Unfortunately when I work on it incrementally (add a component, attach data to it, add data to corresponding json file, save everything at once) I need to restart my dev server (yarn develop) everytime I add something.
gatsby-transformer-json.json file in your attached data folder.json fileI expected Gatsby to refresh the schema on-the-fly as the file changes.
I need to restart the dev server to see the new properties from my .json files.
gatsby-config.js:
module.exports = {
siteMetadata: {
title: '***'
},
plugins: [
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: '***'
}
},
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'data',
path: `${__dirname}/src/data`
}
},
'gatsby-transformer-json',
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
'gatsby-plugin-netlify'
]
};
package.json:
{
"name": "***",
"description": "***",
"version": "0.1.0",
"author": "***",
"private": true,
"scripts": {
"build:css": "postcss src/assets/input.css -o src/assets/output.css",
"watch:css": "postcss src/assets/input.css -o src/assets/output.css -w",
"build": "yarn build:css && gatsby build",
"develop": "yarn watch:css & gatsby develop",
"serve": "gatsby serve",
"lint": "npm-run-all lint:eslint lint:flow",
"lint:eslint": "eslint src",
"lint:flow": "flow src"
},
"dependencies": {
"classnames": "^2.2.5",
"date-fns": "^1.29.0",
"gatsby": "^1.9.241",
"gatsby-image": "^1.0.46",
"gatsby-link": "^1.6.39",
"gatsby-plugin-google-analytics": "^1.0.30",
"gatsby-plugin-netlify": "^1.0.19",
"gatsby-plugin-react-helmet": "^2.0.8",
"gatsby-plugin-sharp": "^1.6.42",
"gatsby-source-filesystem": "^1.5.33",
"gatsby-transformer-json": "^1.0.16",
"gatsby-transformer-sharp": "^1.6.22",
"humanize-duration": "^3.14.0",
"jsonp": "^0.2.1",
"postcss-cli": "^5.0.0",
"react": "^16.3.2",
"react-dom": "^16.3.2",
"react-helmet": "^5.2.0",
"react-player": "^1.4.0",
"tailwindcss": "^0.5.1"
},
"devDependencies": {
"babel-eslint": "^8.2.2",
"eslint": "^4.19.1",
"eslint-plugin-flowtype": "^2.46.1",
"eslint-plugin-react": "^7.7.0",
"flow-bin": "^0.68.0",
"npm-run-all": "^4.1.2",
"prettier": "^1.11.1",
"tailwindcss-aspect-ratio": "^1.0.0"
}
}
This is unfortunately known limitation - Gatsby creates schema just once during bootstrap and it isn't later updated. We do plan on adding support for updating schema if/when shape of data changes.
@pieh My bad then 馃槃 Thought that if the data from the sources is being successfully updated then the schemas rebuild is also happening. Feel free to close this issue, thanks for clarifying things up 馃憤
Thanks for reporting @sarneeh!
This is unfortunately known limitation - Gatsby creates schema just once during bootstrap and it isn't later updated. We do plan on adding support for updating schema if/when shape of data changes.
Any updates on this ?