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

fix: add React.forwardRef to fix warning #45390

Merged
merged 7 commits into from Oct 20, 2023
Merged

fix: add React.forwardRef to fix warning #45390

merged 7 commits into from Oct 20, 2023

Conversation

li-jia-nan
Copy link
Member

@li-jia-nan li-jia-nan commented Oct 17, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English fix: add React.forwardRef to fix warning
🇨🇳 Chinese 修复 FloatButton 组件报错的问题

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at 2e058ae

Refactored FloatButton component and related components to improve ref forwarding and typing. Used composeRef and React.forwardRef to merge refs and pass them to FloatButton. Created interface.ts to store common types for FloatButton and its usage in BackTop and FloatButtonGroup.

🔍 Walkthrough

🤖 Generated by Copilot at 2e058ae

  • Refactor FloatButton component to accept a generic ButtonRef type instead of specific HTML element types (link,link,link,link,link,link)
  • Use composeRef to merge external and internal refs of FloatButton component in BackTop and FloatButtonGroup components (link,link,link,link,link)
  • Wrap BackTop component with React.forwardRef to enable parent component to access FloatButton ref (link)
  • Remove memo function from default export of BackTop component to avoid warning in development mode (link)
  • Reorder imports in BackTop component and remove unused imports in FloatButtonGroup component (link,link)
  • Create interface.ts file to store common types for FloatButton component and related components (link,link,link)

@stackblitz
Copy link

stackblitz bot commented Oct 17, 2023

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 397.89 KB (-41 B 🔽)
./dist/antd-with-locales.min.js 457.19 KB (-47 B 🔽)

@afc163
Copy link
Member

afc163 commented Oct 17, 2023

需要测试用例

@argos-ci
Copy link

argos-ci bot commented Oct 17, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No change detected - Oct 19, 2023, 4:31 PM

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (49ef16b) 100.00% compared to head (4734b8d) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #45390   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          694       694           
  Lines        11676     11678    +2     
  Branches      3118      3120    +2     
=========================================
+ Hits         11676     11678    +2     
Files Coverage Δ
components/float-button/BackTop.tsx 100.00% <100.00%> (ø)
components/float-button/FloatButton.tsx 100.00% <100.00%> (ø)
components/float-button/FloatButtonGroup.tsx 100.00% <100.00%> (ø)

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

@li-jia-nan
Copy link
Member Author

需要测试用例

done~

li-jia-nan and others added 2 commits October 17, 2023 22:13
Co-authored-by: MadCcc <1075746765@qq.com>
Signed-off-by: lijianan <574980606@qq.com>
li-jia-nan and others added 3 commits October 20, 2023 00:12
Co-authored-by: MadCcc <1075746765@qq.com>
Signed-off-by: lijianan <574980606@qq.com>
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.

FloatButton has console warning in 5.10.1
4 participants