feat(storybook): globally filter controls and remove usages of table: { disable: true }#20544
Conversation
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #20544 +/- ##
==========================================
+ Coverage 91.39% 91.93% +0.54%
==========================================
Files 485 484 -1
Lines 31370 32772 +1402
Branches 5430 5550 +120
==========================================
+ Hits 28670 30129 +1459
+ Misses 2547 2496 -51
+ Partials 153 147 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
tay1orjones
left a comment
There was a problem hiding this comment.
This cleans things up so much 🙌 LGTM
| * Args matching elements in the GLOBAL_EXCLUDED_CONTROLS array are not shown in the | ||
| * `controls` table | ||
| */ | ||
| export const argTypesEnhancers = [ |
There was a problem hiding this comment.
Worth noting this appears to be considered an experimental API storybookjs/storybook#30749
6e01d87
Closes #20354
This enhancement globally filters controls in the React storybook and removes previous usages of
table: { disable: true },in favour of Storybook's include/exclude control filtering, while also maintaining all argTypes for documentation purposes in the Overview pages.The following controls are globally filtered:
Changelog
New
Added an argTypesEnhancers to
preview.jsthat takes in an array of strings/regexes "GLOBAL_EXCLUDED_CONTROLS" of controls we want to globally filter out by applyingtable: { disable: true },to themThis method was used due to a limitation with Storybook's parameters. Globally filtering controls via
parameters = { controls: { exclude: .... },would block the ability to filter controls specific to a single component's stories, the global filter would get overwritten. This then leads to us having to either reapply the global filter on top of a specific filter for each story, or usetable: { disable: true },, both of which are methods that weaken this enhancement and its purpose.argTypesEnhancersallows for developers to use story specific control filtering with no issue.The filter also ensures that controls/args aren't filtered out of the
Overviewpages, as even though they may not be used in the stories, they are useful as documentation for users.Changed
table: { disable: true },toparameters = { controls: { exclude/include: .... },throughout the codebaseRemoved
table: { disable: true },to disable controls throughout codebasetable: { disable: true },that hid argType from theOverviewpage throughout the codebaseTesting / Reviewing
table: { disable: true },in the storybook files in this branchPR Checklist
As the author of this PR, before marking ready for review, confirm you:
[ ] Wrote passing tests that cover this change[ ] Addressed any impact on accessibility (a11y)