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(Upload): add flushSync for onChange in control mode #38833

Open
wants to merge 1 commit into
base: 4.x-stable
Choose a base branch
from

Conversation

jaykou25
Copy link

[English Template / 英文模板]

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

#38545

💡 需求背景和解决方案

需求背景: React版本为v18时, Upload组件在受控模式下并且同时上传多个文件时, onChange里的fileList内容是过期的, 并不是最新的. 原因是React 18中对时间间隔较短的状态更新进行了批量处理。

解决方案: 对传入的onChange函数用flushSync处理.

📝 更新日志

语言 更新描述
🇺🇸 英文 Fix Upload trigger mistake files status when upload multiple files at same time and both in control mode in React 18.#38545
🇨🇳 中文 修复 Upload 在 React 18 下并且在受控状态时同时上传多份文件会出现上传状态不正确的问题。#38545

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

github-actions bot commented Nov 22, 2022

@codecov
Copy link

codecov bot commented Nov 22, 2022

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (956edfd) compared to base (4288039).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##           4.x-stable    #38833   +/-   ##
============================================
  Coverage      100.00%   100.00%           
============================================
  Files             447       447           
  Lines            8323      8324    +1     
  Branches         2534      2535    +1     
============================================
+ Hits             8323      8324    +1     
Impacted Files Coverage Δ
components/upload/Upload.tsx 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@li-jia-nan li-jia-nan added 4.x In Ant Design 4.0 and removed codeball:needs-review labels Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x In Ant Design 4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants