ladle icon indicating copy to clipboard operation
ladle copied to clipboard

Unable to override defaultValue false using Story.args

Open ddubrava opened this issue 1 year ago • 1 comments

Describe the bug

If defaultValue in Story.argTypes is set to false, it cannot be overridden by a value in Story.args. This behavior occurs only when the default value is false. If it is set to true, the value can be changed to false through the story configuration. Same for 0/1

Reproduction

https://stackblitz.com/edit/ladle-rj7vgnvr

Environment

  • OS: MacOS
  • Browser: Chrome
  • Version: Chrome 134

ddubrava avatar Mar 26 '25 14:03 ddubrava

https://github.com/tajo/ladle/blob/a53ff48aa3584ef88c74a2a7288bd983933a12bc/packages/ladle/lib/app/src/args-provider.tsx#L110

https://github.com/tajo/ladle/blob/a53ff48aa3584ef88c74a2a7288bd983933a12bc/packages/ladle/lib/app/src/args-provider.tsx#L112

All "falsy" values use the defaultValue. Replace it with undefined, please

ddubrava avatar Mar 26 '25 14:03 ddubrava