Skip to content

refactor(select-button): migrate SelectButton from Flow to TypeScript - #4757

Merged
mergify[bot] merged 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-select-button
Aug 12, 2026
Merged

mergify[bot] merged 1 commit into
box:masterfrom
bonchevskyi:refactor/flow-to-ts-select-button

Conversation

@bonchevskyi

@bonchevskyi bonchevskyi commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Convert SelectButton component to TypeScript

This PR converts src/components/select-button from JavaScript with Flow to TypeScript.

Changes

  • Converted SelectButton.js to SelectButton.tsx with exported SelectButtonProps interface
  • Converted index.js to index.ts, re-exporting the component and its types
  • Converted SelectButton.stories.js to SelectButton.stories.tsx
  • Converted __tests__/SelectButton.test.js to SelectButton.test.tsx
  • Created .js.flow files for backward compatibility

Testing

  • Ran tests for src/components/select-button; all 4 pass with regenerated snapshots matching previous output
  • yarn lint:ts and flow check pass
  • Manually verified in Storybook (Components/SelectButton) that behavior is unchanged

Summary by CodeRabbit

  • New Features
    • Added a reusable select button with disabled-state support and standard button properties.
    • Added validation error styling and configurable error tooltips.
    • Added support for custom styling, child content, and button ref forwarding.
    • Exported the component and its associated type for broader use.
  • Tests
    • Added coverage for rendering, disabled state, validation errors, snapshots, and tooltip positioning.

@bonchevskyi
bonchevskyi requested a review from a team as a code owner August 10, 2026 11:54
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 70cfa9d9-8bb5-4249-bab3-4ab8bc342d5d

📥 Commits

Reviewing files that changed from the base of the PR and between d9ba5ee and dffd89f.

📒 Files selected for processing (2)
  • src/components/select-button/SelectButton.tsx
  • src/components/select-button/__tests__/SelectButton.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/select-button/SelectButton.tsx

Walkthrough

The PR adds typed TypeScript and Flow implementations of SelectButton. It supports forwarded refs, button props, disabled state, invalid styling, configurable error tooltips, typed exports, and test coverage.

Changes

SelectButton component

Layer / File(s) Summary
Component contract and exports
src/components/select-button/SelectButton.tsx, src/components/select-button/SelectButton.js.flow, src/components/select-button/index.ts, src/components/select-button/index.js.flow
The component supports forwarded button refs, standard button props, disabled state, invalid styling, and configurable error tooltips. TypeScript and Flow entrypoints export the component.
Tooltip and state test coverage
src/components/select-button/__tests__/SelectButton.test.tsx
Tests cover children, disabled state, error tooltip visibility, snapshots, and TooltipPosition.MIDDLE_LEFT alignment.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: ready-to-merge

Suggested reviewers: vitali-usik, jpan-box

Poem

A rabbit checks each typed ref,
And keeps the button props correct.
Error tooltips softly glow,
Disabled buttons do not go.
Clean exports complete the set.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the migration of SelectButton from Flow to TypeScript.
Description check ✅ Passed The description explains the migration, lists the affected files, and documents test, lint, Flow, and Storybook validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/select-button/SelectButton.js.flow`:
- Around line 9-17: Update the Props type for SelectButton so className and
isDisabled are optional, matching their existing default values and the
supported runtime/TypeScript contract. Keep the defaults at the existing
implementation locations and change only these two property declarations.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ff5b4148-dd16-4fea-bc74-8ce55aec0ae3

📥 Commits

Reviewing files that changed from the base of the PR and between 84b90a7 and d9ba5ee.

⛔ Files ignored due to path filters (1)
  • src/components/select-button/__tests__/__snapshots__/SelectButton.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • src/components/select-button/SelectButton.js.flow
  • src/components/select-button/SelectButton.stories.tsx
  • src/components/select-button/SelectButton.tsx
  • src/components/select-button/__tests__/SelectButton.test.tsx
  • src/components/select-button/index.js.flow
  • src/components/select-button/index.ts
💤 Files with no reviewable changes (1)
  • src/components/select-button/SelectButton.stories.tsx

@coderabbitai coderabbitai Bot left a comment

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.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/select-button/SelectButton.js.flow`:
- Around line 9-17: Update the Props type for SelectButton so className and
isDisabled are optional, matching their existing default values and the
supported runtime/TypeScript contract. Keep the defaults at the existing
implementation locations and change only these two property declarations.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ff5b4148-dd16-4fea-bc74-8ce55aec0ae3

📥 Commits

Reviewing files that changed from the base of the PR and between 84b90a7 and d9ba5ee.

⛔ Files ignored due to path filters (1)
  • src/components/select-button/__tests__/__snapshots__/SelectButton.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (6)
  • src/components/select-button/SelectButton.js.flow
  • src/components/select-button/SelectButton.stories.tsx
  • src/components/select-button/SelectButton.tsx
  • src/components/select-button/__tests__/SelectButton.test.tsx
  • src/components/select-button/index.js.flow
  • src/components/select-button/index.ts
💤 Files with no reviewable changes (1)
  • src/components/select-button/SelectButton.stories.tsx
🛑 Comments failed to post (1)
src/components/select-button/SelectButton.js.flow (1)

9-17: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make defaulted Flow props optional.

Lines 23 and 26 provide defaults, but Lines 11 and 14 require both properties. Flow will reject <SelectButton> calls that omit className or isDisabled, although the runtime and TypeScript contract support those calls. Mark both properties optional.

Proposed fix
 type Props = {
     children?: React.Node,
-    className: string,
+    className?: string,
     error?: React.Node,
     errorTooltipPosition?: Position,
-    isDisabled: boolean,
+    isDisabled?: boolean,
     /** A CSS class for the tooltip's tether element component */
     tooltipTetherClassName?: string,
 };

This conflicts with the stated Flow backward-compatibility objective.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

type Props = {
    children?: React.Node,
    className?: string,
    error?: React.Node,
    errorTooltipPosition?: Position,
    isDisabled?: boolean,
    /** A CSS class for the tooltip's tether element component */
    tooltipTetherClassName?: string,
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/select-button/SelectButton.js.flow` around lines 9 - 17,
Update the Props type for SelectButton so className and isDisabled are optional,
matching their existing default values and the supported runtime/TypeScript
contract. Keep the defaults at the existing implementation locations and change
only these two property declarations.

vitali-usik
vitali-usik previously approved these changes Aug 10, 2026
Comment thread src/components/select-button/SelectButton.tsx Outdated
Comment thread src/components/select-button/SelectButton.tsx Outdated
Comment thread src/components/select-button/index.ts
@bonchevskyi
bonchevskyi force-pushed the refactor/flow-to-ts-select-button branch from dffd89f to 55c3838 Compare August 12, 2026 10:52
@mergify

mergify Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-08-12 11:05 UTC · Rule: Automatic strict merge · triggered by rule Automatic merge queue
  • Checks skipped · PR is already up-to-date
  • Merged2026-08-12 11:06 UTC · at 55c38381cab7dce72b6e843e50339382b1aebc65 · squash

This pull request spent 18 seconds in the queue, including 2 seconds running CI.

Required conditions to merge
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Summary
    • check-neutral = Summary
    • check-skipped = Summary
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_test_build
    • check-neutral = lint_test_build
    • check-skipped = lint_test_build
  • any of [🛡 GitHub branch protection]:
    • check-success = license/cla
    • check-neutral = license/cla
    • check-skipped = license/cla
  • any of [🛡 GitHub branch protection]:
    • check-success = lint_pull_request
    • check-neutral = lint_pull_request
    • check-skipped = lint_pull_request

@mergify
mergify Bot merged commit 632a22d into box:master Aug 12, 2026
9 of 10 checks passed
@mergify mergify Bot removed the queued label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants