Skip to content

Conversation

@yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Jul 8, 2025

What?

Closes #70639

This PR introduces support for an onSuccess callback in the uploadMedia function. The callback is intended to execute after the upload process completes successfully and all related promises are resolved, allowing for post-upload handling or additional operations.

Why?

  • This enables execution of custom logic after the upload process completes successfully, with the callback receiving the full file context for further handling.
  • onSuccess is already being passed by mediaUpload, which is a wrapper over uploadMedia.
    Ref.

How?

By simply wrapping the upload calls within a Promise.all and executing onSuccess post resolution.

Testing Instructions

N/A

Testing Instructions for Keyboard

N/A

@Mamaduka
Copy link
Member

Mamaduka commented Jul 8, 2025

I think onSuccess is part of a new experimental feature, and currently, core has no use for it (#66290). cc @swissspidy

@swissspidy
Copy link
Member

^ That is correct. This is something that will be introduced as part of the whole client-side media processing work, which is ongoing. See #61447

@yogeshbhutkar
Copy link
Contributor Author

yogeshbhutkar commented Jul 8, 2025

I just wanted to understand if passing onSuccess serves any purpose here, if it doesn't, then perhaps it's best to modify the docStrings as the callback doesn't trigger at all because of the missing implementation. What do you guys think?

@swissspidy
Copy link
Member

Not at the moment. Like I said, it's still work in progress, so not all of the pieces are currently there.

The way it will work is that onSuccess is actually not part of media-utils, but the upload-media package. All uploads will be routed through there.

You can see the intended functionality in https://github.com/swissspidy/media-experiments or #64278 (a bit outdated)

@yogeshbhutkar yogeshbhutkar deleted the fix-70639/upload-media-on-success branch July 8, 2025 09:28
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.

Media Utils: Missing implementation for onSuccess within uploadMedia

3 participants