From 9aa445aae4d4289b6a5f02a92d934e34474759be Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Fri, 19 Jan 2018 11:07:56 -0800 Subject: [PATCH] Revert "Enable filtering on linked nodes" (#3613) * Revert "Fix images disappearing from rendered markdown files (#3612)" This reverts commit 01022ababac93e7d27a0f292e1c987ccbc96b255. * Revert "Bundle Netlify CMS styles (#3611)" This reverts commit d19ec31bdcb560a84297d360f639be2d40d83b44. * Revert "Publish" This reverts commit 53f66a4648989e604340afb9afa59751ea08b38c. * Revert "Update comment" This reverts commit 2b22c2c437a74460d421c1803f2636d1a41cddc6. * Revert "Enable filtering on linked nodes (#3600)" This reverts commit 7120e5ad4337ac903a683da999c96c51a6029d44. --- .../infer-graphql-input-type-test.js | 29 ------------------- .../src/schema/infer-graphql-input-fields.js | 9 ++---- .../gatsby/src/schema/infer-graphql-type.js | 2 +- 3 files changed, 3 insertions(+), 37 deletions(-) diff --git a/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js b/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js index aac4e6c5dd031..dd11b0e4448d9 100644 --- a/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js +++ b/packages/gatsby/src/schema/__tests__/infer-graphql-input-type-test.js @@ -482,33 +482,4 @@ describe(`GraphQL Input args`, () => { expect(result).toMatchSnapshot() }) - - it(`filters on linked fields`, async () => { - const { store, getNodes } = require(`../../redux`) - const linkedNodeType = new GraphQLObjectType({ - name: `Bar`, - fields: { - id: { type: GraphQLString }, - }, - }) - let types = [{ name: `Bar`, nodeObjectType: linkedNodeType }] - - store.dispatch({ - type: `CREATE_NODE`, - payload: { id: `baz`, internal: { type: `Bar` } }, - }) - - let result = await queryResult( - [...getNodes(), { linked___NODE: `baz`, foo: `bar` }], - ` - { - allNode(filter: { linked: { id: { eq: "baz" } } }) { - edges { node { linked { id } } } - } - } - `, - { types } - ) - expect(result.data.allNode.edges[0].node.linked.id).toEqual(`baz`) - }) }) diff --git a/packages/gatsby/src/schema/infer-graphql-input-fields.js b/packages/gatsby/src/schema/infer-graphql-input-fields.js index 29bde30b78a55..fea138023e433 100644 --- a/packages/gatsby/src/schema/infer-graphql-input-fields.js +++ b/packages/gatsby/src/schema/infer-graphql-input-fields.js @@ -19,8 +19,6 @@ const { isEmptyObjectOrArray, } = require(`./data-tree-utils`) -const { findLinkedNode } = require(`./infer-graphql-type`) - import type { GraphQLInputFieldConfig, GraphQLInputFieldConfigMap, @@ -203,11 +201,8 @@ export function inferInputObjectStructureFromNodes({ // setting traversing up not try to automatically infer them. if (isRoot && EXCLUDE_KEYS[key]) return - // Infer input arguments for linked nodes - if (_.includes(key, `___NODE`)) { - value = findLinkedNode(value) - ;[key] = key.split(`___`) - } + // Input arguments on linked fields aren't currently supported + if (_.includes(key, `___NODE`)) return let field = inferGraphQLInputFields({ nodes, diff --git a/packages/gatsby/src/schema/infer-graphql-type.js b/packages/gatsby/src/schema/infer-graphql-type.js index 34b5bf75db102..22a400c24031d 100644 --- a/packages/gatsby/src/schema/infer-graphql-type.js +++ b/packages/gatsby/src/schema/infer-graphql-type.js @@ -252,7 +252,7 @@ function inferFromMapping( } } -export function findLinkedNode(value, linkedField, path) { +function findLinkedNode(value, linkedField, path) { let linkedNode // If the field doesn't link to the id, use that for searching. if (linkedField) {