-
Notifications
You must be signed in to change notification settings - Fork 149
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
docs(FileUpload): add API decisions #2010
docs(FileUpload): add API decisions #2010
Conversation
|
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 306c303:
|
✅ PR title follows Conventional Commits specification. |
packages/blade/src/components/FileUpload/_decisions/decisions.md
Outdated
Show resolved
Hide resolved
packages/blade/src/components/FileUpload/_decisions/decisions.md
Outdated
Show resolved
Hide resolved
9323a6d
to
e7d0e60
Compare
packages/blade/src/components/FileUpload/_decisions/decisions.md
Outdated
Show resolved
Hide resolved
packages/blade/src/components/FileUpload/_decisions/decisions.md
Outdated
Show resolved
Hide resolved
packages/blade/src/components/FileUpload/_decisions/decisions.md
Outdated
Show resolved
Hide resolved
|
||
type BladeFileList = BladeFile[]; | ||
|
||
type FileUploadCommonProps = { |
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.
What callback would the user get when an upload is cancelled midway?
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.
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.
onRemove
theek hai na?
So upload can get cancelled 2 ways
- User cancels it - we call
onRemove
because user can cancel it only by clicking the X button - Internet/Server Failure - what will we call here?
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.
@chaitanyadeorukhkar In case of server failure, the consumers will need to set file.status
to error
. We can cancel/remove via trashicon/closeicon button only. We don't have control over the submit/upload logic so consumers can control their server failures.
Screen.Recording.2024-02-23.at.4.24.42.PM.mov
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.
onRemove theek hai na?
So we trigger onRemove
when either CloseIcon Or TrashIcon is clicked, right?
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.
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.
no I mean is it us who call API internally in our component? or do consumers call it?
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.
no I mean is it us who call API internally in our component? or do consumers call it?
@saurabhdaware Consumers have control of the submit logic, check examples I've added in this doc for more info
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.
so clicking on close icon always calls onCancel
right? should we call it onCloseButtonClick
, onDismiss
in that case similar to our other components?
Because to me, cancel implies that uploading got cancelled but in case where we show error and show close icon, we're not exactly cancelling the upload request no? upload request just failed the validation and the callback was called AFTER the consumer dismissed the error
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.
Yeah, onDismiss
is more suitable.
Pretty Markdown Doc
This PR addresses the decisions made for the FileUpload component API.