-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
MediaReplaceFlow: improve error customization #22995
Conversation
Size Change: +1.52 kB (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
cfe809e
to
35ba92e
Compare
35ba92e
to
bdeb9e5
Compare
I went through this PR and the one thing I would like to ask is if we shouldn't add the same kind of middleware like |
are these tackled by |
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.
:))) yes you are right @retrofox, all the other actions are handled, so this is perfect, basically adding consistency, great work.
Description
This PR adds some changes in order to be able to handle errors when something fails in the media replacing flow. It adds a filter to the component which allows catching the notices (among all other customizations that a filter provides) and also adds an optional
onFilesUpload
property helpful when we want to know files to upload.How to use it
The following example shows how to change the status and description of all notices.
How has this been tested?
These changes shouldn't modify the MediaReplaceFlow API which means that everything should be ok when you upload a new media using the
Replace
button. It's available in many blocks, for instancecore/cover
.So the first testing is replacing a media from this button.
Also, you could modify how the
Replace
button renders, binding a function to the filter hook. The example shown above is a good and valid example of how to do it. In the following, I've replaced the staus of the notice always toinfo
, even when I try to upload an invalid file. Also, added an example of how to useonFilesUpload
property:Screenshots
Types of changes
Checklist: