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: Table should not crash if filterDropdown is boolean #44357

Merged
merged 3 commits into from Aug 23, 2023

Conversation

MadCcc
Copy link
Member

@MadCcc MadCcc commented Aug 22, 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

close #44351

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Table that would crash when filterDropdown do not support ref.
🇨🇳 Chinese 修复 Table 组件 filterDropdown 不支持 ref 时报错的问题。

☑️ 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 fab89f5

Improved the menu component's ref handling and added a regression test for the table component's filter dropdown. These changes fix a bug and enhance the performance and usability of the components.

🔍 Walkthrough

🤖 Generated by Copilot at fab89f5

  • Import supportRef function to check children's ref support (link)
  • Modify OverrideProvider component to conditionally clone children with ref (link)
  • Add test case for table component with boolean filterDropdown prop (link)
  • Prevent table component crash when filterDropdown is boolean (issue #32879, link)

@stackblitz
Copy link

stackblitz bot commented Aug 22, 2023

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 22, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Aug 22, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 388.34 KB (+60 B 🔺)
./dist/antd-with-locales.min.js 447.31 KB (+54 B 🔺)

@argos-ci
Copy link

argos-ci bot commented Aug 22, 2023

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

Build Status Details Updated (UTC)
default (Inspect) ✅ No change detected - Aug 23, 2023, 9:59 AM

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (4d12efe) 100.00% compared to head (506c866) 100.00%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #44357   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          660       660           
  Lines        11230     11250   +20     
  Branches      3039      3041    +2     
=========================================
+ Hits         11230     11250   +20     
Files Changed Coverage Δ
components/menu/OverrideContext.tsx 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

@@ -34,9 +35,17 @@ export const OverrideProvider = React.forwardRef<
],
);

const shouldRef =
typeof children !== 'string' &&
Copy link
Contributor

Choose a reason for hiding this comment

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

感觉这里可以用 isValidElement

Copy link
Member Author

Choose a reason for hiding this comment

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

等会去改一下 supportRef

{
title: 'Name',
dataIndex: 'name',
filterDropdown: true,
Copy link
Member

Choose a reason for hiding this comment

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

filterDropdown 为啥可以为 true?

Copy link
Member Author

Choose a reason for hiding this comment

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

ReactNode 包含 boolean

Copy link
Member Author

Choose a reason for hiding this comment

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

虽然是不期望的用法,但是用户依赖了这个特性,并且以前的版本是 work 的

Copy link
Member

Choose a reason for hiding this comment

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

好的,居然以前是 ok 的。

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.

Tabe filterIcon does not work
4 participants