csf
csf copied to clipboard
Add toString to fix bug in storybook
Storybook seems to be passing integers to sanitize causing it to crash the application. I've tested that adding toString prevents it from breaking.
FYI this happens whenever calling a function called add
with a numeric literal passed to it inside of my applicattion source code
Hey @matthew-gerstman
I faced the same issue and explained it in details here: https://github.com/storybookjs/storybook/pull/18930#issue-1338144975
And I think white list (only accept string
type) is better than black list (accept other types, eg. number
and Object
, and do some additional operations and then return string value) here.