Repository navigation
Fix: Playlist: A failed Replace upload clears the track's title, artist, album, image and length - #86018
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the |
|
Hi @t-hamano, Apologies for a ping here. Could you please check or not sure who's the right person here, if that change was intentional or a miss? IMO, the changes should not get removed if the media upload fails, just like how client side media processing does that, but server side media processing if failed, it clears all past attributes. Just wanted to know your thoughts 🙇. Ref: #85951 (comment) |
Maybe @carolinan or @scruffian would know? (I only looked at git blame) |
t-hamano
left a comment
There was a problem hiding this comment.
Thanks for the ping.
Reading this comment, the agreement seems to be that the existing track should be kept when an upload fails. Given that, the approach in this PR makes sense to me.
gutenberg/packages/block-library/src/playlist-track/edit.jsx
Lines 103 to 104 in 5157b3f
This code comment is indeed confusing, but I think it was copied from the Audio block, which still has the same comment from its older implementation:
gutenberg/packages/block-library/src/audio/edit.jsx
Lines 97 to 108 in 20f8c21
For reference, the Image, Audio and Video blocks reset their media-related attributes and go back to the placeholder state when an upload fails:
I think this is a leftover from when there was no local blob attribute, and the temporary blob URL was written directly into the src attribute during upload. These three blocks now handle blob URLs through the local blob attribute and temporaryURL, so if the only goal is to clean up blob URLs, resetting the blob attribute, as this PR does, should be enough. Whether to change the behavior of those three blocks is a separate discussion, though, and I think it's out of scope for this PR.
|
Thanks @t-hamano, For clearing the confusion here. I agree other blocks is a separate discussion, I can create a followup ticket and we can continue on that. Meanwhile the PR and Issue's scope is limited to the playlist block, and if PR is in good shape then we can plan to move forward with this, while creating a followup for three blocks as shared. |
Created a followup ticket to fix the same here - #86289 |
What?
Closes #85951
When a Replace upload fails, the Playlist track now keeps its title, artist, album, image and length.
Why?
On a failed server-side upload,
MediaReplaceFlowcallsonSelect( undefined ), andonSelectTrackcleared every track attribute exceptsrc. The track lost its details in the editor, and because itsidwas cleared, it was also left out on the front end (#83857).How?
onSelectTracknow clears onlybloband the temporary URL, and leaves the track's other attributes as they were.blob. It usestoStrictEqual, becausetoEqualignores keys set toundefinedand would pass on the old code.The change is needed because, when a client side media upload fails, it does not update anything and uses the previous attributes only, so the same should happen when server side uploads processing is available.
Testing Instructions
window.__clientSideMediaProcessingshould beundefined. If it'strue, addadd_filter( 'wp_client_side_media_processing_enabled', '__return_false' );to a mu-plugin.npm run test:unit -- packages/block-library/src/playlist-track/test/edit.jsdom.test.jsx.Testing Instructions for Keyboard
None
Screenshots or screencast
Screen.Recording.2026-10-29.at.8.11.38.PM.mov
Use of AI Tools
Used Claude Code (Claude Opus 5.5) to trace the cause and draft the fix, the test change, and this description. I reviewed and tested the changes myself.