Skip to content
Discussion options

You must be logged in to vote

This is expected behavior as it adds those fields during the createSchemaCustomization step which runs after the createNodes (when onCreateNode is called).

const MdxType = schema.buildObjectType({
name: `Mdx`,
fields: {
rawBody: { type: `String!` },
fileAbsolutePath: { type: `String!` },
frontmatter: { type: `MdxFrontmatter` },
slug: {
type: `String`,
async resolve(mdxNode, args, context) {
const nodeWithContext = context.nodeModel.findRootNodeAncestor(
mdxNode,
node => node.internal && node.internal.type === `File`
)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dustinlacewell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants