chore(lint): convert Storybook stories and shared helpers to function components#39451
chore(lint): convert Storybook stories and shared helpers to function components#39451
Conversation
…omponents Converts all .stories.tsx files across plugins and packages, plus shared .storybook/shared utilities, from class components to function components. No functional changes — purely structural cleanup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Bito Automatic Review Skipped - Branch Excluded |
| handleToggle() { | ||
| this.setState(({ open }) => ({ open: !open })); | ||
| } | ||
| export default function Expandable({ children, expandableWhat }: Props) { |
There was a problem hiding this comment.
Suggestion: expandableWhat is optional, but the button label interpolates it directly; when omitted, users will see "Show undefined". Provide a default value in the function params so the label always renders meaningful text. [logic error]
Severity Level: Minor 🧹
- ⚠️ Storybook Expandable helper can show "Show undefined" labels.
- ⚠️ New stories omitting label prop get confusing button text.| export default function Expandable({ children, expandableWhat }: Props) { | |
| export default function Expandable({ | |
| children, | |
| expandableWhat = 'content', | |
| }: Props) { |
Steps of Reproduction ✅
1. Open `superset-frontend/.storybook/shared/Expandable.tsx` (lines 22–25) where `Props`
is defined with `expandableWhat?: string;`, making the prop optional.
2. Note in the same file at line 41 that the button label is constructed as ``{`${open ?
'Hide' : 'Show'} ${expandableWhat}`}``, which interpolates `expandableWhat` directly into
the string.
3. Verify via search (`Grep` for `<Expandable` under
`/superset-frontend/packages/superset-ui-core/src/**/*.stories.tsx`) that current usages,
e.g. `Connection.stories.tsx` lines 15–20 and `ChartDataProvider.stories.tsx` lines 13–17,
always pass `expandableWhat="payload"`, so the issue is not triggered by existing stories
today.
4. Create or modify any Storybook story in this repo to render `<Expandable>` without the
`expandableWhat` prop (which is allowed by the `?:` typing), run Storybook, and observe
that the button in `Expandable.tsx` line 41 renders the label `"Show undefined"`/`"Hide
undefined"` instead of a meaningful description.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/.storybook/shared/Expandable.tsx
**Line:** 27:27
**Comment:**
*Logic Error: `expandableWhat` is optional, but the button label interpolates it directly; when omitted, users will see "Show undefined". Provide a default value in the function params so the label always renders meaningful text.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.There was a problem hiding this comment.
Pre-existing behavior on master — the previous class version rendered the same label pattern (${open ? 'Hide' : 'Show'} ${expandableWhat}) with an optional expandableWhat. Not introduced by this PR. Leaving as-is.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## chore/lint-cleanup-function-components #39451 +/- ##
=======================================================================
Coverage 64.45% 64.45%
=======================================================================
Files 2541 2541
Lines 131662 131662
Branches 30517 30517
=======================================================================
Hits 84863 84863
Misses 45333 45333
Partials 1466 1466
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:
|
…mports to correct subpaths
- CountryMap.stories: drop spurious theme={supersetTheme} prop and
unused supersetTheme import (let SuperChart use active theme).
- Path.stories: merge duplicate @apache-superset/core/theme imports.
Summary
.stories.tsxfiles across plugins and packages from class components to function components.storybook/shared/utilities (Expandable, VerifyCORS, createQueryStory)Part of the broader class→function component lint cleanup tracked in #37902.
Test plan
Additional information
This is sub-PR 1 of ~10, each targeting
chore/lint-cleanup-function-components.🤖 Generated with Claude Code