Skip to content

fix(coze-design): 修复 Tooltip 触发的 React 更新警告 - #146

Open
win5do wants to merge 1 commit into
coze-dev:mainfrom
win5do:fix/tooltip-react-update-warning
Open

fix(coze-design): 修复 Tooltip 触发的 React 更新警告#146
win5do wants to merge 1 commit into
coze-dev:mainfrom
win5do:fix/tooltip-react-update-warning

Conversation

@win5do

@win5do win5do commented Aug 3, 2026

Copy link
Copy Markdown

问题

Semi UI 2.72.3 在 Tooltip 打开时可能输出以下 React 警告:

An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects.

该问题也会影响基于 Tooltip / Popover 实现的组件,例如 DatePicker。

根因是受影响版本的 Tooltip 在 setState updater 内触发 portalInserted 事件;事件处理函数会同步计算浮层位置并再次触发 state 更新,因此被 React 判定为 updater 内的嵌套更新。

相关上游记录:

上游修复已包含在 Semi UI 2.85.0 中。

修改内容

  • @douyinfe/semi-ui~2.72.3 升级到 ~2.85.0
  • 同步 coze-design、组件文档和 editor dev 的 Semi UI 版本,保持 Rush 依赖版本一致
  • 增加 Tooltip 打开和关闭时不再输出目标 React 警告的回归测试
  • @coze-arch/coze-design 添加 patch change entry

影响

Tooltip 及基于 Tooltip / Popover 的组件打开时,不再产生上述 React nested-update 警告。API 使用方式不变。

验证

  • rush update
  • rush check
  • rush change --verify
  • coze-design 测试:68 个测试文件通过,415 项测试通过,1 项跳过
  • coze-design build 通过
  • coze-design lint:0 error

@CLAassistant

CLAassistant commented Aug 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@win5do
win5do marked this pull request as ready for review August 3, 2026 06:15
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