From d2998a7075ff67ee92ccebc6b559e4ddb72f0bf4 Mon Sep 17 00:00:00 2001 From: John Gerrard Holland Date: Mon, 24 Jul 2023 19:01:32 -0400 Subject: [PATCH 1/2] fix: order of projectTeam coming out of query to match the input array --- .../gatsby-node.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 }, }, From 8f554db2b23cd62ebac47c1ba5ac4096488586ab Mon Sep 17 00:00:00 2001 From: John Gerrard Holland Date: Mon, 24 Jul 2023 19:03:07 -0400 Subject: [PATCH 2/2] test: reorder contacts for one project as an example --- packages/example-site/content/project/completed-project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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",