Skip to content

Commit

Permalink
refactor: remoteIdFields no more (#104)
Browse files Browse the repository at this point in the history
* chore(deps): Bump gatsby-graphql-source-toolkit

* refactor: remoteIdFields no more

Generate fragements

* fix: Ensure MarkdownNode type always created

* chore(deps): Bump gatsby-graphql-source-toolkit
  • Loading branch information
Jonathan Steele authored Aug 25, 2020
1 parent 62aeb5e commit a7d4b5b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
19 changes: 16 additions & 3 deletions gatsby-source-graphcms/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,24 @@ const createSourcingConfig = async (

const gatsbyNodeTypes = possibleTypes.map((type) => ({
remoteTypeName: type.name,
remoteIdFields: ['__typename', 'id'],
queries: `
query LIST_${pluralRootFieldName(type)} { ${pluralRootFieldName(
type
)}(first: $limit, skip: $offset) }
)}(first: $limit, skip: $offset) {
..._${type.name}Id_
}
}
query NODE_${singularRootFieldName(type)} { ${singularRootFieldName(
type
)}(where: $where) }`,
)}(where: $where) {
..._${type.name}Id_
}
}
fragment _${type.name}Id_ on ${type.name} {
__typename
id
}
`,
nodeQueryVariables: ({ id }) => ({ where: { id } }),
}))

Expand Down Expand Up @@ -198,6 +208,9 @@ exports.createSchemaCustomization = (

if (buildMarkdownNodes)
createTypes(`
type GraphCMS_MarkdownNode implements Node {
id: ID!
}
type GraphCMS_RichText {
markdownNode: GraphCMS_MarkdownNode @link
}
Expand Down
2 changes: 1 addition & 1 deletion gatsby-source-graphcms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
],
"license": "MIT",
"dependencies": {
"gatsby-graphql-source-toolkit": "0.2.2",
"gatsby-graphql-source-toolkit": "0.4.1",
"gatsby-source-filesystem": "2.3.18",
"he": "1.2.0",
"node-fetch": "2.6.0"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6123,10 +6123,10 @@ gatsby-graphiql-explorer@^0.4.10:
dependencies:
"@babel/runtime" "^7.10.3"

gatsby-graphql-source-toolkit@0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/gatsby-graphql-source-toolkit/-/gatsby-graphql-source-toolkit-0.2.2.tgz#07c37eb23c330099c9e9d3d59b3981a999a1ab2f"
integrity sha512-gx98EGdzpq3LDd5YNTSdciZDExhOQRLW2kzrc9tLf61N2oV3pnQ1zIrQ5RJHNjKwLUndyfDRmK85bYqYLLcPuA==
gatsby-graphql-source-toolkit@0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/gatsby-graphql-source-toolkit/-/gatsby-graphql-source-toolkit-0.4.1.tgz#09018b007038867d1095821530e831395b1593a7"
integrity sha512-FvdFD0Qh+K6sMTpVHX+Imd6iFk7jsIEIxieEm82gFa9suI5osUKtUZPPvtkqbjyYKYWuPObWv/XvKJDc9JxyuA==
dependencies:
"@types/node-fetch" "^2.5.7"
lodash "^4.17.15"
Expand Down

0 comments on commit a7d4b5b

Please sign in to comment.