Make WordPress Core

Opened 7 weeks ago

Last modified 7 weeks ago

#62902 new defect (bug)

Description of featured image is being deleted

Reported by: jogashst's profile jogashst Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.7.1
Component: Media Keywords: has-screenshots has-testing-info has-patch
Focuses: Cc:

Description

The description of featured image is being deleted while going to replace from post editor page.
How to reproduce:

  1. Upload a image with setting values only for "Alternative Text" & "Description" fields. https://i.imgur.com/DGjZBzi.png
  2. Create a post & set featured image which uploaded.
  3. Save as draft or publish the post.
  4. Reload the post editor page & try to replace feature image, then you will notice that the description field is empty.

https://i.imgur.com/gHUBWYY.png
https://i.imgur.com/bEWi1JU.png

My Environment:
PHP: 8.2.4
Wordpress version :6.7.1
Theme: Twenty Twenty-Five
And no plugins were installed.

Attachments (2)

Change History (7)

#1 @vishalmori
7 weeks ago

Hello @jogashst,
I tried to reproduce your issue with saving the post as a draft and publishing, but it seems to work perfectly. In latest clean setup with Twenty Twenty-Five and no plugins were installed.

#2 @sukhendu2002
7 weeks ago

  • Keywords has-screenshots added

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.7.1
  • PHP: 8.2.27
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.41 / Client: mysqlnd 8.2.27)
  • Browser: Chrome 132.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

I am also able to reproduce this in the current trunk.

Supplemental Artifacts

First Replace click:

https://dnkrslddof.ufs.sh/f/TTyF6MLuAyHDAVSpSBHoCxQWLRgXDtkZ1vzHVEhqJP64IB0r

Replace click again:
https://dnkrslddof.ufs.sh/f/TTyF6MLuAyHDL11Hg7nXmnMvVdTcYSZ7CaAlh0eQfzgpxyrE

Last edited 7 weeks ago by sukhendu2002 (previous) (diff)

#4 @sukhendu2002
7 weeks ago

  • Keywords has-testing-info added

This ticket was mentioned in PR #8256 on WordPress/wordpress-develop by @yogeshbhutkar.


7 weeks ago
#5

  • Keywords has-patch added

Trac ticket: #62902

### Description

https://github.com/WordPress/wordpress-develop/blob/7d10dd7b0fde2a782395887c2d66439481440f9b/src/js/media/views/attachment.js#L587-L589

This code bails out early when the updated value matches the DOM, but the model starts with defaults (e.g., an empty title), and AJAX delays can leave values uninitialized. This can block re-renders, especially when the data becomes available post the AJAX call.

While the early return prevents unnecessary updates, it shouldn't apply when multiple changes occur simultaneously during initialization. Instead, bailing out only when a single change occurs—and it matches the DOM—ensures proper hydration and fixes the bug.

### Screencast

https://github.com/user-attachments/assets/5f3b33c3-cdd7-4e26-adef-aaf8d263ac02

Note: See TracTickets for help on using tickets.