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

Storybook adds actionHandler function to every function prop #15421

Closed
allangrds opened this issue Jun 29, 2021 · 3 comments
Closed

Storybook adds actionHandler function to every function prop #15421

allangrds opened this issue Jun 29, 2021 · 3 comments

Comments

@allangrds
Copy link

allangrds commented Jun 29, 2021

Describe the bug
I have the following component:

const Footer = ({ onBack, onFinish, onNext }: FooterProps) => {  
    return (
      <S.Wrapper>
        {onBack && (
          <div>
            <SecondaryButton
              backgroundColor="#fff"
              onClick={onNext}
              text="Voltar"
            />
          </div>
        )}
        {onNext && (
          <div>
            <Button onClick={onNext} text="Avançar" />
          </div>
        )}
        {onFinish && (
          <div>
            <Button onClick={onFinish} text="Finalizar" />
          </div>
        )}
      </S.Wrapper>
    );
  };

and my Footer.stories.tsx:

import React from 'react';
import { Meta, Story } from '@storybook/react';

import Footer from '~/components/Footer';

export default {
  title: 'components/Footer',
  component: Footer,
} as Meta;

const Template: Story<any> = (args) => <Footer {...args} />

export const OnlyNext = Template.bind({})

OnlyNext.args = {
  onNext: () => null,
}

The problemn here is: I'm always seeing the 3 buttons, not just the button I prop in the story.

System
Environment Info:
System:
OS: macOS 11.4
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Binaries:
Node: 14.17.1 - ~/.nvm/versions/node/v14.17.1/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v14.17.1/bin/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.1/bin/npm
Browsers:
Chrome: 91.0.4472.114
Firefox: 89.0.2
Safari: 14.1.1
npmPackages:
@storybook/addon-actions: 6.3.0 => 6.3.0
@storybook/addon-essentials: 6.3.0 => 6.3.0
@storybook/addon-links: 6.3.0 => 6.3.0
@storybook/node-logger: 6.3.0 => 6.3.0
@storybook/preset-create-react-app: 3.1.7 => 3.1.7
@storybook/react: 6.3.0 => 6.3.0

@shilman
Copy link
Member

shilman commented Jun 30, 2021

Closing as dupe to #15370 which has been fixed in 6.3.1

@shilman shilman closed this as completed Jun 30, 2021
@slinkardbrandon
Copy link

This appears to be broken again in 6.3.12

@brandonthomas
Copy link

Yah I'm still seeing this

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

4 participants