Skip to content

Commit

Permalink
Merge pull request #520 from thepolicylab-projectportals/fix/dont-re-…
Browse files Browse the repository at this point in the history
…sort-project-team

fix: don't re-sort the project team
  • Loading branch information
hollandjg authored Jul 29, 2023
2 parents 69e6c92 + 31b5131 commit a0f2efa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/example-site/content/project/completed-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 12 additions & 6 deletions packages/project-portal-content-netlify/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
Expand Down

0 comments on commit a0f2efa

Please sign in to comment.