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

[LG-4631] fix 500 page crash when required prop is deselected #407

Draft
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

stephl3
Copy link
Contributor

@stephl3 stephl3 commented Jan 15, 2025

LG-4631

In the live example pages, when a knob uses a Select to set the prop value, allowDeselect={true} by default. However, the prop value of a deselected option is "" which in some cases will throw an error and crash the page. Specifically for the Code component, deselecting the language prop would set language="" which is an invalid prop.

This change will set allowDeselect={false} for all knobs with control type of 'radio'. For props like language that cannot be deselected, the appropriate storybook control in the storybook file must be set to type: 'radio'.

in *.stories.tsx

propName: {
  options: Object.values(OptionNames),
  control: { type: 'radio' },
}

@stephl3 stephl3 force-pushed the steph/oc-fix-deselect-crash branch from 837e3a3 to de2f0d3 Compare January 15, 2025 22:42
@stephl3 stephl3 marked this pull request as draft March 6, 2025 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant