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

[Bug]: calling updateArgs doesn't trigger docs addon transform function #27140

Open
chimericdream opened this issue May 14, 2024 · 0 comments
Open

Comments

@chimericdream
Copy link

chimericdream commented May 14, 2024

Describe the bug

I have a story with a controls panel under it, and when I make changes in the controls panel, the story canvas re-renders as expected. However the "Show code" block just underneath only ever shows the initial args passed to the story. I have a parameters.docs.source.transform function, which is only called once when the story initially renders. It appears that calling updateArgs (which the controls addon appears to do under the hood) doesn't trigger anything in the docs addon to execute the transform function again with the updated arguments.

To Reproduce

I don't have the ability to create a stackblitz reproduction at the moment, but I'll try to get one added this evening.

The transform function looks like this:

transform: (unused: string, context: StoryContext): string => {
    const { args } = context;

    return `<${args.variant} size="${args.size}" />`;
},

Update: I am not going to be able to make a reproduction for at least a few days due to going out of town, but here is a screen recording showing the issue.

Screen.Recording.2024-05-15.at.9.25.52.AM.mov

System

Storybook Environment Info:
  System:
    OS: macOS 14.4.1
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.1 - ~/.nvm/versions/node/v20.12.1/bin/node
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.1/bin/npm <----- active
    pnpm: 8.15.6 - ~/.nvm/versions/node/v20.12.1/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.208
    Edge: 124.0.2478.105
    Safari: 17.4.1

Additional context

No response

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

2 participants