Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code block displaying [object Object] when @storybook/components is used #18090

Closed
okonet opened this issue Apr 28, 2022 · 13 comments
Closed

Code block displaying [object Object] when @storybook/components is used #18090

okonet opened this issue Apr 28, 2022 · 13 comments

Comments

@okonet
Copy link
Contributor

okonet commented Apr 28, 2022

Describe the bug

When using @storybook/components (as per reproduction case) I see [object Object] instead of the code in the code block:

CleanShot 2022-04-28 at 12 23 47@2x

To Reproduce

https://github.com/okonet/storybook-reproduction-code-block

System

Environment Info:

  System:
    OS: macOS 11.4
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 16.14.2 - /opt/homebrew/opt/node@16/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.5.0 - /opt/homebrew/opt/node@16/bin/npm
  Browsers:
    Chrome: 101.0.4951.41
    Firefox: 97.0.1
    Safari: 14.1.1
  npmPackages:
    @storybook/addon-essentials: 6.5.0-beta.0 => 6.5.0-beta.0 
    @storybook/client-logger: 6.5.0-beta.0 => 6.5.0-beta.0 
    @storybook/components: 6.5.0-beta.0 => 6.5.0-beta.0 
    @storybook/react: 6.5.0-beta.0 => 6.5.0-beta.0 
    @storybook/theming: 6.5.0-beta.0 => 6.5.0-beta.0 
@shilman
Copy link
Member

shilman commented May 3, 2022

Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-beta.3 containing PR #18127 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed May 3, 2022
@shilman
Copy link
Member

shilman commented May 3, 2022

@okonet can you try the new release? seems to be working for me now

@SlexAxton
Copy link

I'm still getting this problem with 6.5.0-beta.4

This is me trying to get the react-ts example to work with no new code:

{
  "name": "",
  "private": true,
  "version": "0.0.1",
  "description": "foo",
  "license": "UNLICENSED",
  "type": "commonjs",
  "scripts": {
    "build-storybook": "STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true build-storybook",
    "debug": "NODE_OPTIONS=--inspect-brk STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true start-storybook -p 9011",
    "storybook": "STORYBOOK_DISPLAY_WARNING=true DISPLAY_WARNING=true start-storybook -p 9011 --no-manager-cache"
  },
  "dependencies": {
    "formik": "^2.2.9",
    "preact": ">=10.5.13 <11.0.0",
    "prop-types": "15.7.2",
    "react": "^18.1.0",
    "react-dom": "^18.1.0"
  },
  "devDependencies": {
    "@babel/core": ">=7.13.0 <8.0.0",
    "@babel/preset-env": "^7.12.11",
    "@babel/preset-react": "^7.12.10",
    "@babel/preset-typescript": "^7.12.7",
    "@storybook/addon-a11y": "^6.4.22",
    "@storybook/addon-essentials": "6.5.0-beta.4",
    "@storybook/addon-storyshots": "6.5.0-beta.4",
    "@storybook/addon-storysource": "6.5.0-beta.4",
    "@storybook/addons": "6.5.0-beta.4",
    "@storybook/cli": "6.5.0-beta.4",
    "@storybook/components": "6.5.0-beta.4",
    "@storybook/mdx2-csf": "0.0.1-canary.1.838a6ca.0",
    "@storybook/react": "6.5.0-beta.4",
    "@storybook/theming": "6.5.0-beta.4",
    "@testing-library/dom": "^7.31.2",
    "@testing-library/react": "12.1.2",
    "@testing-library/user-event": "^13.1.9",
    "@types/babel__preset-env": "^7",
    "@types/react": "^16.14.23",
    "@types/react-dom": "^16.9.14",
    "jest": "^28.0.3",
    "lodash": "^4.17.21",
    "react-docgen-typescript": "^2.2.2",
    "require-from-string": "^2.0.2",
    "typescript": "^4.6.3",
    "webpack": "4"
  }
}

image

@shilman
Copy link
Member

shilman commented May 4, 2022

@SlexAxton is that in the monorepo or a standalone repo? And why is there a preact dependency?

@SlexAxton
Copy link

that’s taking the folder from the monorepo and making it into a standalone folder, and then installing peerDeps until its happy. preact is a peerDep for something now i guess :)

@okonet
Copy link
Contributor Author

okonet commented May 4, 2022

I can see it in the monorepo as well but it only after the fresh start:

cd examples/react-ts
yarn run storybook

CleanShot 2022-05-04 at 14 35 58@2x

After the page is refreshed it is showing the proper code:

CleanShot 2022-05-04 at 14 36 24@2x

I'm still investigating the cause...

@SlexAxton
Copy link

SlexAxton commented May 4, 2022 via email

@shilman
Copy link
Member

shilman commented May 9, 2022

Hurrah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-beta.7 containing PR #18158 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

@okonet
Copy link
Contributor Author

okonet commented May 12, 2022

Looks like we could try undoing our "fix": wooorm/refractor#61

@bacium
Copy link

bacium commented Mar 14, 2023

image
I have configured Button.stories.tsx, but it is displayed as [object, Object] in the show code, how to deal with this problem,

@guofei0723
Copy link

guofei0723 commented Jun 12, 2023

image I have configured Button.stories.tsx, but it is displayed as [object, Object] in the show code, how to deal with this problem,

v7.0.20, same issue

The component of this story is a component of a third-party library, I just re-exported it

@Jared-Dahlke
Copy link

Jared-Dahlke commented Sep 27, 2023

this is happening to me with ShadCN components on latest storybook 7.4. Most of the code blocks have Object OBject in them

@AngusMacrae
Copy link

The open issue relating to this is here
#20920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants