Skip to content

Conversation

@cactuser-Lu
Copy link

@cactuser-Lu cactuser-Lu commented Dec 5, 2025

chore: Bump react-draggable from 4.4.3 to 4.5.0

Summary by CodeRabbit

发布说明

  • 依赖更新

    • 升级可拖拽功能库至最新版本
  • 文档改进

    • 优化示例代码实现,改进拖拽功能的集成方式

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 5, 2025

Someone is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

@gemini-code-assist
Copy link

Summary of Changes

Hello @cactuser-Lu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on upgrading the react-draggable dependency to its latest minor version. This update necessitated a small but important change in an existing example file to ensure compatibility and proper functionality of the draggable component, specifically by introducing a nodeRef to the draggable element.

Highlights

  • Dependency Update: The react-draggable library has been updated from version 4.4.3 to 4.5.0.
  • Example Code Adjustment: The draggable.tsx example file was modified to incorporate a nodeRef when using the Draggable component, which is often required for react-draggable to correctly identify the draggable element in newer versions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

总体概述

升级react-draggable依赖至v4.5.0版本,并更新示例代码以使用nodeRef ref属性来改进拖拽组件的行为。

变更详情

文件群组 / 文件 变更摘要
依赖更新
package.json
将react-draggable从^4.4.3升级至^4.5.0
示例代码更新
docs/examples/draggable.tsx
引入nodeRef本地ref,更新modalRender将模态框包装在div中并将ref传给Draggable组件

代码审查工作量评估

🎯 1 (Trivial) | ⏱️ ~3 分钟

  • 依赖升级为标准版本号更新
  • 示例代码改动为单一用途的ref注入,逻辑简洁直观
  • 无复杂的控制流或多文件交互

诗歌

🐰 ✨
依赖升级到新高度,
nodeRef轻轻握在手,
拖拽更顺滑如梦,
小小改动大智慧!
🎉 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确描述了主要变更:将react-draggable依赖从4.4.3升级到4.5.0,虽然实际代码中还包含draggable.tsx的ref处理更新,但标题清晰概括了最主要的改动。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 401b183 and 7b86f8a.

📒 Files selected for processing (2)
  • docs/examples/draggable.tsx (2 hunks)
  • package.json (1 hunks)
🔇 Additional comments (3)
docs/examples/draggable.tsx (2)

10-10: nodeRef 引用声明正确。

引入 nodeRef 是为了与 react-draggable 的新版本兼容,避免使用已弃用的 findDOMNode。这种模式符合 React 18+ 的最佳实践。


50-50: Implementation is correct and follows react-draggable 4.5.0 best practices.

The modalRender implementation properly uses the nodeRef pattern introduced in v4.4.0:

  • Creates a wrapper div with ref={nodeRef}
  • Passes the same nodeRef={nodeRef} to the Draggable component

This pattern is the official recommendation for react-draggable 4.5.0 and ensures React 18 compatibility by avoiding deprecated findDOMNode warnings. No changes required.

package.json (1)

84-84: react-draggable 4.5.0 is valid and secure.

Confirmed that react-draggable 4.5.0 exists (released June 25, 2025) with no known security vulnerabilities. The version includes bugfixes and performance improvements (clsx update, Shadow DOM bounds fix, allowMobileScroll). No breaking changes identified.


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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request bumps the react-draggable dependency from version 4.4.3 to 4.5.0. The changes in docs/examples/draggable.tsx are a necessary adaptation for the new version of react-draggable. To ensure compatibility with React's StrictMode and avoid the deprecated findDOMNode API, the example has been updated to use the nodeRef prop. A ref is created with useRef, passed to the Draggable component, and attached to a new wrapper div. The implementation is correct and follows the recommended pattern for the updated library. The changes look good.

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.46%. Comparing base (401b183) to head (7b86f8a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #528   +/-   ##
=======================================
  Coverage   98.46%   98.46%           
=======================================
  Files           8        8           
  Lines         195      195           
  Branches       68       68           
=======================================
  Hits          192      192           
  Misses          3        3           

☔ 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.

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.

1 participant