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(image-uploader): upload props ts type #6821

Conversation

huangmingfu
Copy link

fix: #6799

Copy link
Contributor

github-actions bot commented Feb 4, 2025

Preview is ready

@@ -199,7 +199,7 @@ export const ImageUploader = forwardRef<ImageUploaderRef, ImageUploaderProps>(
await Promise.all(
newTasks.map(async (currentTask, index) => {
try {
const result = await props.upload(currentTask.file)
const result = await props.upload!(currentTask.file)
Copy link
Member

Choose a reason for hiding this comment

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

这样会有问题,upload 不传会报错。

Copy link
Author

@huangmingfu huangmingfu Feb 4, 2025

Choose a reason for hiding this comment

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

是的,其他情况会,我是看他说的 disableUpload 的情况,onChange 就不会触发。
多加一个这个呢?

if (!props.upload && !props.disableUpload) { 
   console.error('提示upload必传')
   return
}

Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.70%. Comparing base (18d3b83) to head (a3d500b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6821   +/-   ##
=======================================
  Coverage   92.70%   92.70%           
=======================================
  Files         335      335           
  Lines        7199     7199           
  Branches     1793     1805   +12     
=======================================
  Hits         6674     6674           
  Misses        490      490           
  Partials       35       35           

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

@huangmingfu huangmingfu closed this Feb 6, 2025
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.

image-uploader 的 props 必传导致的 ts 类型问题
2 participants