Closed soren121 closed 4 months ago
Given this example component:
import * as React from "react"; interface ButtonComponentProps { text: string; } export const Button = (props: ButtonComponentProps) => ( <button>{props.text}</button> ); Button.displayName = "MyButtonDisplayName";
generateDocgenCodeBlock({ docgenCollectionName: "STORYBOOK_REACT_CLASSES" }) outputs:
generateDocgenCodeBlock({ docgenCollectionName: "STORYBOOK_REACT_CLASSES" })
try { // @ts-ignore MyButtonDisplayName.displayName = "MyButtonDisplayName"; // @ts-ignore Button.__docgenInfo = { "description": "", "displayName": "MyButtonDisplayName", "props": { "text": { "defaultValue": null, "description": "", "name": "text", "required": true, "type": { "name": "string" } } } }; // @ts-ignore if (typeof STORYBOOK_REACT_CLASSES !== "undefined") // @ts-ignore STORYBOOK_REACT_CLASSES["DisplayName.tsx#MyButtonDisplayName"] = { docgenInfo: MyButtonDisplayName.__docgenInfo, name: "MyButtonDisplayName", path: "DisplayName.tsx#MyButtonDisplayName" }; } catch (__react_docgen_typescript_loader_error) { }"
The component's identifier name is Button, but the codeblock assigns displayName to MyButtonDisplayName, which does not exist. In the global collection object, it uses MyButtonDisplayName.__docgenInfo, which likewise doesn't exist.
Button
displayName
MyButtonDisplayName
MyButtonDisplayName.__docgenInfo
:rocket: Issue was released in v1.0.8 :rocket:
v1.0.8
Given this example component:
generateDocgenCodeBlock({ docgenCollectionName: "STORYBOOK_REACT_CLASSES" })
outputs:The component's identifier name is
Button
, but the codeblock assignsdisplayName
toMyButtonDisplayName
, which does not exist. In the global collection object, it usesMyButtonDisplayName.__docgenInfo
, which likewise doesn't exist.