Conversation
…/idea-board into migrate-resources
…/idea-board into migrate-resources-1
…ea-board into migrate-resources
✅ Deploy Preview for project-idea-board ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Adds support for linking “related ideas” between idea posts by introducing a first-class IdeaPost node type in Gatsby’s data layer, wiring up CMS configuration, and updating idea listing/detail pages to query/render the new node shape.
Changes:
- Add a
related_ideasrelation field to the Ideas collection in Decap CMS and surface it on idea detail pages. - Introduce an explicit
IdeaPostGraphQL node type + resolvers (parallel toResource) and move schema definitions intogatsby/schema/base.gql. - Refactor IdeaRoll and the idea-post template to query
IdeaPostnodes instead ofMarkdownRemark.frontmatter/fields.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| static/admin/config.yml | Adds a “Related Ideas” relation field to the Ideas CMS editor. |
| src/types/index.ts | Updates Idea post typing to use ideaPost query result shape. |
| src/templates/idea-post.tsx | Switches to querying ideaPost and renders related ideas. |
| src/pages/ideas/dev-example.md | Adds example related_ideas frontmatter. |
| src/components/IdeaRoll.tsx | Refactors idea list to use allIdeaPost query and simplified rendering. |
| gatsby/utils/gatsby-resolver-utils.js | Adds ideaPostQuery helper for nodeModel lookups. |
| gatsby/schema/base.gql | Defines the new IdeaPost node type and related schema types. |
| gatsby/resolvers/resolvers.js | Adds IdeaPost field resolvers (including relatedIdeas). |
| gatsby/constants.js | Adds constants for IdeaPost typing and ideas slug directory. |
| gatsby-node.js | Wires schema customization and resolvers for IdeaPost, and updates page creation logic. |
Comments suppressed due to low confidence (1)
gatsby-node.js:10
gatsby-node.jsstill importsstringWithDefault,resolveToArray, andresourceQueryfromgatsby-resolver-utils, but they are no longer referenced in this file after moving logic intocreateIdeaPostResolver. Removing these unused imports will avoid confusion and potential lint failures.
const { createIdeaPostResolver } = require("./gatsby/resolvers/resolvers");
const {
stringWithDefault,
resolveToArray,
resourceQuery,
} = require("./gatsby/utils/gatsby-resolver-utils");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
static/admin/config.yml
Outdated
| display_fields: ["title"], | ||
| multiple: true, | ||
| required: false, | ||
| hint: "Select any related ideas to associate with this one.", |
There was a problem hiding this comment.
would it cause a problem if people select a related idea 1 -> 2 and 2->1?
I know you asked about this, and I think it might be best to have it always be "select any ideas this a descendant of "
There was a problem hiding this comment.
I don't think it would cause a problem, but the question exposes the one way nature of this design.
As this is writte now:
associating 1 and 2 in the context of 1, doesn't mean that 1 and 2 are associated in the context of 2.
Stably identifying ideas with parent child relationships means that we need to edit multiple markdown files anytime we create one of these links. So if 1 and 2 have a parent-child relationship, and we define that when editing Idea 1, we then need to also edit 2 to mark the parent relationship. You would resolve peers by looking at shared parents.
Interestingly, gatsby nodes have a built in parent/child data structure, but I think this would be a hacky way of exploiting it, if we used it for this purpose.
There was a problem hiding this comment.
I guess my question is: in practice are ideas really likely to have obvious parent-child relationships? What conversations with scientists or toy examples show that being the case? Or are they more likely to be loosely networked and associated? That loose association is also captured somewhat with tags.
There was a problem hiding this comment.
I think we said this is the only change that is needed: changing it to "select ideas this is a child/descendent of" or something
Problem
Closes #42
Would be nice to get this in before design review next week so that as many pieces of the design puzzle as possible are in place.
Solution
This address the issue about by adding a "related ideas" field to ideas.
Idea relations are flat, not parent-child. No in depth styling:
I also followed the pattern from "resources" and made an Idea node in our data layer.
I've been aiming for this for a while, while the plugin will in fact create a MarkdownRemark node for all our
.mdfiles, and we can definitely query them, I think it's best for our main data structures to be explicitly typed and non-overlapping.Attendant to that change:
gastby-node.jsand intobase.gqlIdeaPostinstead ofFrontmatterand extracted it into a seprate file (the file move is just for org/readabiltity)idea-post.tsx