Skip to content

【Auto】Fix: Trigger uploadProps onRemove in AIChatInput#3138

Open
SudoUserReal wants to merge 1 commit intomainfrom
solve/issue-3100-1772009334105
Open

【Auto】Fix: Trigger uploadProps onRemove in AIChatInput#3138
SudoUserReal wants to merge 1 commit intomainfrom
solve/issue-3100-1772009334105

Conversation

@SudoUserReal
Copy link
Collaborator

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Test Case
  • TypeScript definition update
  • Document improve
  • CI/CD improve
  • Branch sync
  • Other, please describe:

PR description

Fixes #3100

AIChatInput 的附件删除按钮是自定义实现,删除时仅更新内部附件状态并触发 onChange,但没有走 Upload 的移除流程,导致传入的 uploadProps.onRemove(以及 beforeRemove 的拦截逻辑)不会生效。

本次修复在 foundation 的删除逻辑中补齐与 Upload 一致的 remove 事件链路:删除前执行 uploadProps.beforeRemove(支持 Promise,返回 false/resolve false 则阻止删除),删除后触发 uploadProps.onRemove 并同步相关变更回调。

同时补充了 foundation 级别回归测试覆盖 onRemove 触发与 beforeRemove 阻断场景,并更新组件文档说明相关回调行为,方便使用者正确接入。

Changelog

🇨🇳 Chinese

  • Fix: 修复 AIChatInput 删除附件时未触发 uploadProps.onRemove,且 beforeRemove 无法阻断的问题

🇺🇸 English

  • Fix: Fix AIChatInput attachment removal not triggering uploadProps.onRemove and not honoring beforeRemove

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

新增测试位于 packages/semi-ui/aiChatInput/__test__/aiChatInputFoundation.test.js,覆盖 beforeRemove(含 Promise)返回 false 时不删除,以及删除后触发 onRemove 的行为。

This commit was automatically generated by Semi Issue Solver.
Closes #3100
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4ac5283:

Sandbox Source
pr-story Configuration

@cypress
Copy link

cypress bot commented Feb 25, 2026

semi-design    Run #3456

Run Properties:  status check failed Failed #3456  •  git commit b1cac4bc43 ℹ️: Merge 4ac52838035b00e995d35519894088b6a457fdf4 into c889f07a167fe6e1bbf3c9de42f9...
Project semi-design
Branch Review solve/issue-3100-1772009334105
Run status status check failed Failed #3456
Run duration 08m 16s
Commit git commit b1cac4bc43 ℹ️: Merge 4ac52838035b00e995d35519894088b6a457fdf4 into c889f07a167fe6e1bbf3c9de42f9...
Committer SudoUser
View all properties for this run ↗︎

Test results
Tests that failed  Failures 1
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 13
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 290
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

Tests for review

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.

[BUG] <title>AIChatInput uploadProps的onRemove回调不生效

1 participant