Skip to content

fix: Reduce the required props for ResizableBox#264

Open
SheaJanke wants to merge 1 commit into
react-grid-layout:masterfrom
SheaJanke:fix-required-props
Open

fix: Reduce the required props for ResizableBox#264
SheaJanke wants to merge 1 commit into
react-grid-layout:masterfrom
SheaJanke:fix-required-props

Conversation

@SheaJanke
Copy link
Copy Markdown

@SheaJanke SheaJanke commented May 26, 2026

  • The only required props for ResizableBox should be height, width, and children. Previously the keys from DefaultProps were required as well.

closes: #263

Summary by CodeRabbit

  • New Features

    • ResizableBox component now works with only width and height props—all other configuration options are optional.
  • Tests

    • Added test case verifying the component renders correctly with minimal required props and includes default resize handles.

Review Change Stack

* The only required props for ResizableBox should be height, width,
  and children. Previously the keys from DefaultProps were required
  as well.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cb68e1ef-7741-4ec3-b993-b51aac4ea254

📥 Commits

Reviewing files that changed from the base of the PR and between b6b2c53 and bd2afef.

📒 Files selected for processing (2)
  • __tests__/ResizableBox.test.tsx
  • lib/propTypes.ts

📝 Walkthrough

Walkthrough

This PR fixes a TypeScript type issue in react-resizable where DefaultProps fields were incorrectly marked as required, even though they all have runtime defaults. The Props type is now wrapped in Partial<DefaultProps>, and a new test validates that ResizableBox renders correctly with minimal props.

Changes

Props Type Relaxation

Layer / File(s) Summary
Props type and ResizableBox minimal props test
lib/propTypes.ts, __tests__/ResizableBox.test.tsx
The exported Props type wraps DefaultProps in Partial<> to make all default props optional. A new test confirms that ResizableBox renders successfully with only width and height props, validating that the DOM element reflects the specified dimensions and the default "se" resize handle is rendered.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A small hop through TypeScript terrain,
Where defaults were hiding in the rain,
Now props flow free, optional and light,
ResizableBox renders just right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: making DefaultProps fields optional instead of required in ResizableBox props.
Linked Issues check ✅ Passed The changes directly address issue #263 by making DefaultProps fields optional via Partial, allowing ResizableBox to be used with only width, height, and children.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the TypeScript type definition issue; the test addition validates the fix and no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 and usage tips.

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.

TypeScript: DefaultProps fields incorrectly required in Props type

1 participant