diff --git a/packages/example-site/content/project/completed-project.json b/packages/example-site/content/project/completed-project.json index a90b15a68..1c55734e4 100644 --- a/packages/example-site/content/project/completed-project.json +++ b/packages/example-site/content/project/completed-project.json @@ -2,8 +2,8 @@ "question": "Hello world (from json)?", "mainContact": "first-contact", "projectTeam": [ - "first-contact", - "second-contact" + "second-contact", + "first-contact" ], "title": "completed 1", "agency": "example agency", diff --git a/packages/project-portal-content-netlify/gatsby-node.js b/packages/project-portal-content-netlify/gatsby-node.js index f4f29b515..958f29ce3 100644 --- a/packages/project-portal-content-netlify/gatsby-node.js +++ b/packages/project-portal-content-netlify/gatsby-node.js @@ -126,12 +126,18 @@ exports.createSchemaCustomization = ({ actions, schema, getNode }) => { projectTeam: { type: [CONTACT_JSON_TYPE], resolve: async (source, args, context) => { - const { entries } = await context.nodeModel.findAll({ - type: CONTACT_JSON_TYPE, - query: { - filter: { slug: { in: source.projectTeam ?? [] } }, - }, - }) + projectTeam = source.projectTeam || [] + const entries = [] + projectTeam.forEach((element) => + entries.push( + context.nodeModel.findOne({ + type: CONTACT_JSON_TYPE, + query: { + filter: { slug: { eq: element } }, + }, + }) + ) + ) return entries }, },