-
Notifications
You must be signed in to change notification settings - Fork 1
50: change error return #78
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| if (validationError) { | ||
| onError(validationError); | ||
| if(typeof validationError === 'string'){ | ||
| onFileError(validationError); | ||
| }else{ | ||
| onFileError(validationError.titleError, validationError.subtitleError); | ||
| } | ||
|
|
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.
Что-то случилось с форматированием
| const validationError = validateBeforeUpload(fileList); | ||
| if (validationError) { | ||
| onError(validationError); | ||
| if(typeof validationError === 'string'){ |
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.
Странно делать проверку, что valisationError строка, если ты в типизации указал, что точно нет
packages/pkg.fileuploader/types.ts
Outdated
| descriptionText?: string; | ||
| onChange: (files: File[]) => void; | ||
| validateBeforeUpload?: (files: File[]) => string | undefined; | ||
| validateBeforeUpload?: (files: File[]) => ValidationError | undefined; |
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.
Мы в целом не используем undefined в коде ни для типов, ни для данных. Если мы хотим показать, что чего-то нет, то это null
|
|
||
| const handleError = (fileList: File[]): boolean => { | ||
| if (!enableErrorHandling || !onError) { | ||
| if (!enableErrorHandling || !onFileError) { |
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.
Как будто с такой проверкой у тебя не будет отрабатывать validateBeforeUpload, даже если он есть
No description provided.