gatsby-source-notion-api
gatsby-source-notion-api copied to clipboard
Add support for querying multiple databases available to the Integration
Currently, a databaseId
option is required. gatsby-source-notion-api
only allows fetching data from the database provided via that option. Technically, it is possible for a Notion integration to have access to multiple databases. In this case, you could choose which pages to pull from which database.
I'm playing around with a fix on this issue for my own purposes but went ahead and tagged the issue in my PR on my fork (figured I'd spend the time writing out a future PR now). I'll comment back when I'm finished tinkering with it if you're interested in taking a look.
Thank you, I'm excited to see it! If you have any questions, don't hesitate to reach out.
Instead of modifying the plugin to take in multiple database IDs, another approach might be to use multiple plugins in gatsby-config.js
. I believe gatsby-source-graphql uses this approach (unless I've misunderstood their example).
module.exports = {
plugins: [
{
resolve: "gatsby-source-graphql",
options: {
typeName: "SWAPI",
...
},
},
{
resolve: "gatsby-source-graphql",
options: {
typeName: "GitHub",
...
},
}
],
}
I tried this approach with this plugin and it seems to be fetching both results. In order to make this work, I think you'd only need a parameter that lets you specify the query node name for the result. Currently, it's set to allNotion
, but if you could specify it for each configuration, that might solve the problem.
Thanks @LandonSchropp. That was indeed the simplest solution 👍. Here's the PR related to this: https://github.com/orlowdev/gatsby-source-notion-api/pull/24