Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

<Props /> only working after changes to file #893

Closed
julians opened this issue May 24, 2019 · 7 comments
Closed

<Props /> only working after changes to file #893

julians opened this issue May 24, 2019 · 7 comments
Labels

Comments

@julians
Copy link

julians commented May 24, 2019

Bug Report

<Props of={MyComponent} /> doesn’t render anything until I change and save the component‘s 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
@klujanrosas
Copy link

@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

@zicodeng
Copy link

Related: #777

@ejuo
Copy link
Contributor

ejuo commented Jun 3, 2019

@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.

@nathsimpson
Copy link

nathsimpson commented Jul 9, 2019

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

@brandonarbini
Copy link

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

@jesperorb
Copy link

Does this refer to v1 of docz?

@stale
Copy link

stale bot commented Dec 2, 2019

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.

@stale stale bot added the stale label Dec 2, 2019
@stale stale bot closed this as completed Dec 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants