Docz: `ref` and `key` are not omitted from Props-generated table

Created on 17 Jun 2019  路  2Comments  路  Source: doczjs/docz

Bug Report

Describe the bug

Props component includes ref and key props in props table when passed a component created with React.forwardRef. I would argue these props should not be exposed because they cannot be documented in our code. They are also part of React's API in that they are documented elsewhere and considered assumed knowledge in our docs.

To Reproduce

Create this component

// docs/Faulty.tsx

import React from "react";

export interface FaultyProps {}

const Faulty = React.forwardRef<HTMLDivElement>((props, ref) => {
  return <div ref={ref}>{props.children}</div>;
});

export default Faulty;

With this documentation

{/* docs/Faulty.mdx */}

import { Props } from "docz";
import Faulty from "./Faulty";

# Faulty

<Props of={Faulty} />

Expected behavior

ref and key are omitted from generated props table

Environment

  • OS: macOS 10.14.5
  • Node version: 10.15.3
  • Yarn version: 1.16.0
  • Docz packages:
{
  "docz": "1.2.0",
  "docz-theme-default": "1.2.0"
}

Additional context/Screenshots

image

Most helpful comment

I encountered a similar problem. Moreover, earlier on the same version of docz it was OK, perhaps this is due to the update of third libraries.
The problem is that when calling props.parent (https://github.com/styleguidist/react-docgen-typescript/issues/151), it is always null. And therefore all properties fall into the props table.
UPD: it's breaking for typescript version > 3.5.

All 2 comments

For what it's worth, I tried passing custom docgenConfig but since it propFilter must be a function, it is not parsed correctly by load-cfg.

I encountered a similar problem. Moreover, earlier on the same version of docz it was OK, perhaps this is due to the update of third libraries.
The problem is that when calling props.parent (https://github.com/styleguidist/react-docgen-typescript/issues/151), it is always null. And therefore all properties fall into the props table.
UPD: it's breaking for typescript version > 3.5.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

w0wka91 picture w0wka91  路  3Comments

albinekb picture albinekb  路  3Comments

hayk94 picture hayk94  路  3Comments

mariusespejo picture mariusespejo  路  3Comments

fenbka picture fenbka  路  3Comments