Docz: <Props /> only working after changes to file

Created on 24 May 2019  路  7Comments  路  Source: doczjs/docz

Bug Report

<Props of={MyComponent} /> doesn鈥檛 render anything until I change and save the component鈥榮 file. While this is annoying locally, it breaks the static build.

Happens with a clean npm project with only docs installed.

index.mdx:

import Test from "./Test.js";
import { Props } from "docz";

# Yay

lorem ipsum huhuhu

<Test>yay</Test>

<Props of={Test} />

Test.js:

import React from "react";
import PropTypes from "prop-types";

const Test = ({ children, className }) => {
  return <p className={className}>1 {children} 2</p>;
};

Test.propTypes = {
  /** Additional className for container */
  className: PropTypes.string
};

export default Test;

Expected behavior

Props table should render

Environment

  • OS: OSX 10.14.5
  • Node/npm version: v12.2.0
stale

Most helpful comment

@klujanrosas,
Problem due to very strict filtering of component files on initial build. In watch mode only keys are compared. You need one of two things:

  1. Move your source code to a subfolder, for example src/Button.js.
  2. Overwrite filterComponents.

All 7 comments

@pedronauck here's a repo that reproduces this issue:
https://github.com/klujanrosas/docz-error-repro

Tested this on
Node v10.12.0 - Linux PopOS 18.04 LTS

And on
Node v10.15.3 - Windows 10

@klujanrosas,
Problem due to very strict filtering of component files on initial build. In watch mode only keys are compared. You need one of two things:

  1. Move your source code to a subfolder, for example src/Button.js.
  2. Overwrite filterComponents.

Perfect! Number 2 in @ejuo 's comment worked for me :) Thanks so much

@ejuo's comment worked for me in dev, but not for build. Super confused by this.

Does this refer to v1 of docz?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danburzo picture danburzo  路  3Comments

mquandalle picture mquandalle  路  3Comments

capaj picture capaj  路  3Comments

ssylvia picture ssylvia  路  3Comments

fenbka picture fenbka  路  3Comments