You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the six-file-upload component exposes an event six-file-upload-success, that returns a CustomEvent of type SixFileUploadSuccessPayload. This is a union type of IMultipleFiles | ISingleFile (these types are not exported), where the former has a property called files and the latter a property called file, depending on whether the multiple flag is set.
When using the six-file-upload component, it is difficult to access these properties/events in a type safe manner.
What does the proposed API look like?
My suggestion would be to get rid of IMultipleFiles and ISingleFile and change the interface of SixFileUploadSuccessPayload to be the following:
The event six-file-upload-success should always return an array of files in its event payload. If the component has the property multiple set to false, there will only be one file in the array.
If the change would be implemented like this, this would be a breaking change and we would have to think about adding an additional event and deprecate the current one, or something similar to this.
Additional one could argue, that we could combine the success/failure event (not sure what is the best practice here) and expose just one event which contains a failure/success response and/or the uploaded files. This would force the user to actually handle the failure case. Currently the user is not required to handle the failure case.
The text was updated successfully, but these errors were encountered:
What problem does this feature solve?
Currently the
six-file-upload
component exposes an eventsix-file-upload-success
, that returns a CustomEvent of typeSixFileUploadSuccessPayload
. This is a union type ofIMultipleFiles | ISingleFile
(these types are not exported), where the former has a property calledfiles
and the latter a property calledfile
, depending on whether themultiple
flag is set.When using the
six-file-upload
component, it is difficult to access these properties/events in a type safe manner.What does the proposed API look like?
My suggestion would be to get rid of
IMultipleFiles
andISingleFile
and change the interface ofSixFileUploadSuccessPayload
to be the following:The event
six-file-upload-success
should always return an array of files in its event payload. If the component has the propertymultiple
set to false, there will only be one file in the array.If the change would be implemented like this, this would be a breaking change and we would have to think about adding an additional event and deprecate the current one, or something similar to this.
Additional one could argue, that we could combine the success/failure event (not sure what is the best practice here) and expose just one event which contains a failure/success response and/or the uploaded files. This would force the user to actually handle the failure case. Currently the user is not required to handle the failure case.
The text was updated successfully, but these errors were encountered: