docz: MDXTag Error: "components is not defined"
Bug Report
Describe the bug
When visiting my local docz instance, I am met with the error components is not defined
upon navigating (clicking on a sidebar link) to a specific component’s view.
I am not quite sure what causes the bug. It seems as though my mdx files are compile to be <MDXTag>
components, which accepts a prop components
, but the identifier provided doesn’t seem to exist in the file. 🤷♂️
To Reproduce
Clone, cd packages/core
, npm i
, npm run docz:dev
.
https://github.com/colshacol/g2-ops-component-library
branch: “v1”
Working directly from the packages/core
directory.
Expected behavior
I expect docz to show me the mdx documentation I have written for the specific component.
Environment
macOS High Sierra 10.13.6
node v11.1.0 / v10.8.0
npm v6.2.0 / v6.4.1
// doczrc.js
import { css } from 'docz-plugin-css'
export default {
src: './src/new_components',
plugins: [
css({
preprocessor: 'postcss',
cssmodules: false,
loaderOpts: {
plugins: [],
},
}),
],
}
"docz": "^0.12.12",
"docz-plugin-css": "^0.11.0",
(Same error with 0.12.12, 0.12.11, 0.12.10, and 0.12.9.)
Additional context/Screenshots
Screen recording: https://www.youtube.com/watch?v=XlirTYEnGmg
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 23 (6 by maintainers)
Same error with the latest version of
docz
(0.12.12)Fixed on v0.12.13 ✅
Apologies for this issue, for the time being I recommend pinning
@mdx-js/mdx@0.16.0
, we’ll have it fixed in MDX core tomorrow.I’m not getting the same error as the OP, but definitely getting the @danielbayerlein getting. The usage of
Playground
will always throw an errorprops is not defined
Thanks for v0.12.13 @pedronauck Works like a charm!
Today @berbecki 😃
Also getting
props is not defined
when I use<Playground>
. Looking at the line where the error is thrown:It seems
props
should bethis.props
, judging by its position in theMDXContent
component.I’m getting the same error whenever I use the
<Playground />
component.Note: Before making this issue, I had cleared my yarn cache, npm cache, deleted and re-installed dependencies many times.
I just gave it a go with yarn, and it seems that it did better, but still fell down. Now the error is
props is not defined
. Sill in the same place, though.If bug keeps showing up, try to run
yarn dev --debug
to invalidate cache or re-install yarn stuff@berbecki Once the release is created.
I think this was the diff responsible (2 days ago in
mdx-js
):https://github.com/mdx-js/mdx/commit/c9c2b32c93a1fcffe95ab8a41e6774a6285e5786#diff-b327bc77915c976f12c6d2efb717f068R112
Looks like in the refactoring to a class component, in the
render
methodthis.props
should have replacedprops
. (FWIW that code is in a double-nested template literal; good luck linting that.)