-
-
Notifications
You must be signed in to change notification settings - Fork 459
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(Attachments): fix Attachments onRemove no work #555
Conversation
📝 WalkthroughWalkthrough此变更在 Changes
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
WalkthroughThis pull request addresses an issue with the Changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
components/attachments/index.tsx (1)
26-49
:⚠️ Potential issue缺少 onRemove 属性的类型定义
在组件的属性解构中添加了
onRemove
属性(第 68 行),但在AttachmentsProps
接口中没有对应的类型定义。需要在接口中添加此属性的类型定义,以确保类型安全。建议添加以下定义:
export interface AttachmentsProps extends Omit<UploadProps, 'fileList'> { prefixCls?: string; rootClassName?: string; rootStyle?: React.CSSProperties; style?: React.CSSProperties; className?: string; classNames?: Partial<Record<SemanticType, string>>; styles?: Partial<Record<SemanticType, React.CSSProperties>>; children?: React.ReactElement; disabled?: boolean; // ============= placeholder ============= placeholder?: PlaceholderType | ((type: 'inline' | 'drop') => PlaceholderType); getDropContainer?: null | (() => HTMLElement | null | undefined); // ============== File List ============== items?: Attachment[]; overflow?: FileListProps['overflow']; + onRemove?: (item: Attachment) => Promise<boolean> | boolean; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/attachments/__tests__/index.test.tsx
(1 hunks)components/attachments/index.tsx
(2 hunks)
🔇 Additional comments (1)
components/attachments/__tests__/index.test.tsx (1)
56-77
: 测试用例实现正确新增的测试用例正确验证了
onRemove
返回false
时文件不会被删除的功能。测试思路清晰,断言准确。
Bundle ReportBundle size has no change ✅ |
用例挂了 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #555 +/- ##
==========================================
+ Coverage 91.79% 91.81% +0.01%
==========================================
Files 67 67
Lines 1463 1466 +3
Branches 386 388 +2
==========================================
+ Hits 1343 1346 +3
Misses 120 120 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
close #554
Summary by CodeRabbit
新增功能
测试