-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Closed
Description
I have an issue - gatsby with graphql won't update data from database ( firebase ).
- Server started (
npm run develop) in mygatsby-node.jsdata fetched and dynamic pages created. - I'm going to add some rows into my database - added
- Reloading page (where i should see new items ) => I see there only old items (no new appear). Same even if i will go to
localhost:8000/___graphqlThere is only old data - Going to close connection and start server again
- New data appear
And i have to do it always to see new data.
Any solutions on this?
Thanks!
gatsby-node.js
const _ = require(`lodash`);
const Promise = require(`bluebird`);
const path = require(`path`);
const slug = require(`slug`);
const slash = require(`slash`);
exports.createPages = ({ boundActionCreators, graphql }) => {
const { createPage } = boundActionCreators
return new Promise((resolve, reject) => {
resolve(
graphql(
`
{
allImports {
edges {
node {
id,
opened,
unsubscribed,
uid,
totalCsvLength,
clicked,
complained,
delivered,
duplicate,
failed,
importStartedAt
}
}
}
}
`
).then(result => {
if (result.errors) {
reject(result.errors)
}
const importTemplate = path.resolve(`src/templates/import-detail.js`);
result.data.allImports.edges.map(edge => {
createPage({
path: `/${slug(edge.node.id)}/`,
component: slash(importTemplate),
context: {
id: edge.node.id,
},
})
})
})
)
})
};
gatsby-config.js
module.exports = {
siteMetadata: {
title: `example`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-firebase`,
options: {
// point to the firebase private key downloaded
credential: require("./config/firebase.json"),
// your firebase database root url
databaseURL: "https://url.firebaseio.com",
// you can have multiple "types" that point to different paths
types: [
{
type: "Imports",
path: "imports",
}
]
}
}
],
}
brunont, alirezakay and ChrisAD
Metadata
Metadata
Assignees
Labels
No labels