Skip to content

chore(lint): convert Storybook stories and shared helpers to function components#39451

Draft
rusackas wants to merge 4 commits intomasterfrom
chore/fc-01-stories
Draft

chore(lint): convert Storybook stories and shared helpers to function components#39451
rusackas wants to merge 4 commits intomasterfrom
chore/fc-01-stories

Conversation

@rusackas
Copy link
Copy Markdown
Member

Summary

  • Converts all .stories.tsx files across plugins and packages from class components to function components
  • Includes shared .storybook/shared/ utilities (Expandable, VerifyCORS, createQueryStory)
  • 52 files total — pure structural change, no functional differences

Part of the broader class→function component lint cleanup tracked in #37902.

Test plan

  • CI passes on the target feature branch
  • Storybook renders correctly (spot-check a few stories)

Additional information

This is sub-PR 1 of ~10, each targeting chore/lint-cleanup-function-components.

🤖 Generated with Claude Code

…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-code-review
Copy link
Copy Markdown
Contributor

bito-code-review bot commented Apr 17, 2026

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at evan@preset.io.

@dosubot dosubot bot added change:frontend Requires changing the frontend frontend:refactor Related to refactoring the frontend labels Apr 17, 2026
handleToggle() {
this.setState(({ open }) => ({ open: !open }));
}
export default function Expandable({ children, expandableWhat }: Props) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Suggested change
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.
👍 | 👎

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread superset-frontend/.storybook/shared/VerifyCORS.tsx Outdated
Comment thread superset-frontend/src/filters/components/Range/RangeFilterPlugin.stories.tsx Outdated
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 17, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit a4a3205
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69e26ee737cc0100082f0ecf
😎 Deploy Preview https://deploy-preview-39451--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.45%. Comparing base (5106afb) to head (839dabd).

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           
Flag Coverage Δ
javascript 66.06% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- 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.
@rusackas rusackas changed the base branch from chore/lint-cleanup-function-components to master April 19, 2026 19:28
@rusackas rusackas marked this pull request as draft April 19, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend frontend:refactor Related to refactoring the frontend packages plugins size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant