[gatsby-plugin-mdx 4.1.1] Example of extending the GraphQL "headings" nodes would't work. #36591
Closed
2 tasks done
Labels
status: confirmed
Issue with steps to reproduce the bug that’s been verified by at least one reviewer.
topic: remark/mdx
Related to Markdown, remark & MDX ecosystem
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
The example of creating "headings" GraphQL node seem like missing some thing when calling the
compileMDXWithCustomOptions
.The resolver yield
"TypeError: Cannot read properties of undefined (reading 'getState')"
.And i found the secend parameters of the
compileMDXWithCustomOptions
, which is a object owning "store" attribute. This object would be passed down toenhanceMdxOptions
, which would call thegetState
from the store.gatsby/packages/gatsby-plugin-mdx/src/compile-mdx.ts
Line 83 in e174fbb
gatsby/packages/gatsby-plugin-mdx/src/plugin-options.ts
Line 55 in e174fbb
Therefore, at the example, the object is missing the "store" attribute, undefined has no
getState
, and that causing the error.But i have no idea what is the "store" meaning for, and what to pass in.
Reproduction Link
https://codesandbox.io/s/damp-sea-e242s4?file=/gatsby-node.js
Steps to Reproduce
Just follow the gatsby-plugin-mdx doc.
Expected Result
GraphQL resolve the heading properly.
Actual Result
GraphlQL yield "TypeError: Cannot read properties of undefined (reading 'getState')"
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: