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]: Inconsistent action log when action argument is falsy #26927

Open
skyh opened this issue Apr 23, 2024 · 1 comment
Open

[Bug]: Inconsistent action log when action argument is falsy #26927

skyh opened this issue Apr 23, 2024 · 1 comment

Comments

@skyh
Copy link

skyh commented Apr 23, 2024

Describe the bug

The screenshot contains onClick action invoked with different arguments:

image

Single argument actions containing "falsy" values have different log format than other

To Reproduce

// demo.stories.tsx

import { action } from '@storybook/addon-actions'
import { useCallback } from '@storybook/client-api'
import { StoryFn } from '@storybook/react'

export default {
  component: () => null,
}

export const Demo: StoryFn = () => {
  const runTestActions = useCallback(() => {
    const onClickAction = action('onClick')

    onClickAction(3)
    onClickAction(2)
    onClickAction(1)
    onClickAction(0)
    onClickAction(true)
    onClickAction(false)
    onClickAction(null)
    onClickAction(undefined)
    onClickAction(undefined, undefined)
    onClickAction(undefined, undefined, undefined)
  }, [])

  return <button onClick={runTestActions}>Run test (result in addon-actions tab)</button>
}

System

Storybook Environment Info:

  System:
    OS: macOS 14.4.1
    CPU: (12) arm64 Apple M2 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.2 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.5.0 - /opt/homebrew/bin/npm
    pnpm: 9.0.5 - /opt/homebrew/bin/pnpm <----- active
  Browsers:
    Chrome: 124.0.6367.62
    Safari: 17.4.1
  npmPackages:
    @storybook/addon-actions: 7.6.17 => 7.6.17 
    @storybook/addon-essentials: 7.6.17 => 7.6.17 
    @storybook/addon-interactions: 7.6.17 => 7.6.17 
    @storybook/addon-links: 7.6.17 => 7.6.17 
    @storybook/blocks: 7.6.17 => 7.6.17 
    @storybook/client-api: 7.6.17 => 7.6.17 
    @storybook/react: 7.6.17 => 7.6.17 
    @storybook/react-webpack5: 7.6.17 => 7.6.17 
    @storybook/testing-library: ^0.2.2 => 0.2.2 
    storybook: 7.6.17 => 7.6.17

Additional context

No response

@Spielboerg
Copy link
Contributor

Duplicate of #22163

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