Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: up React.MutableRefObject to React.Ref #52205

Merged
merged 1 commit into from
Jan 2, 2025
Merged

type: up React.MutableRefObject to React.Ref #52205

merged 1 commit into from
Jan 2, 2025

Conversation

li-jia-nan
Copy link
Member

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

image

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English type: up React.MutableRefObject to React.Ref
🇨🇳 Chinese 更新废弃类型

Copy link

stackblitz bot commented Jan 1, 2025

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Jan 1, 2025

Preview is ready

Copy link
Contributor

github-actions bot commented Jan 1, 2025

👁 Visual Regression Report for PR #52205 Failed ❌

🎯 Target branch: master (8164b9e)
📖 View Full Report ↗︎

Expected (Branch master) Actual (Current PR) Diff
input-group.compact.png input-group.compact.png input-group.compact.css-var.png input-group.compact.css-var.png

Important

There are 1 diffs found in this PR: 🔄 1 changed.
Please check all items:

  • Visual diff is acceptable

Copy link

Walkthrough

This pull request updates the TypeScript definitions by changing the type of the ref parameter in the InternalTable component from React.MutableRefObject<HTMLDivElement> to React.Ref<HTMLDivElement>. This change is aimed at improving the TypeScript definitions used in the project.

Changes

File Summary
components/table/InternalTable.tsx Updated the ref type from React.MutableRefObject<HTMLDivElement> to React.Ref<HTMLDivElement> and adjusted the React.forwardRef export accordingly.

@@ -119,7 +119,7 @@ export interface InternalTableProps<RecordType = AnyObject> extends TableProps<R

const InternalTable = <RecordType extends AnyObject = AnyObject>(
props: InternalTableProps<RecordType>,
ref: React.MutableRefObject<HTMLDivElement>,
ref: React.Ref<HTMLDivElement>,

Choose a reason for hiding this comment

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

The change from React.MutableRefObject<HTMLDivElement> to React.Ref<HTMLDivElement> is generally safe, but ensure that the component using this ref handles the possibility of the ref being null, as React.Ref can be null when not assigned.

Copy link
Contributor

github-actions bot commented Jan 1, 2025

size-limit report 📦

Path Size
dist/antd.min.js 442.25 KB
dist/antd-with-locales.min.js 510.34 KB

Copy link

pkg-pr-new bot commented Jan 1, 2025

Copy link

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4ce1676
Status: ✅  Deploy successful!
Preview URL: https://736f4d49.ant-design.pages.dev
Branch Preview URL: https://ref-type-up.ant-design.pages.dev

View logs

Copy link

codecov bot commented Jan 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (8164b9e) to head (4ce1676).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #52205   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          763       763           
  Lines        13643     13643           
  Branches      3560      3560           
=========================================
  Hits         13643     13643           

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

@afc163 afc163 merged commit bb38ef5 into master Jan 2, 2025
49 checks passed
@afc163 afc163 deleted the ref-type-up branch January 2, 2025 08:37
@zombieJ zombieJ mentioned this pull request Jan 6, 2025
16 tasks
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.

2 participants