Make WordPress Core

Opened 21 months ago

Last modified 17 months ago

#62902 new defect (bug)

Description of featured image is being deleted

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

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 (8)

#1 @vishalmori
21 months 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
21 months 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 21 months ago by sukhendu2002 (previous) (diff)

#4 @sukhendu2002
21 months ago

  • Keywords has-testing-info added

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


21 months 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

#6 @wordpressdotorg
17 months ago

  • Keywords has-test-info added; has-testing-info removed
Note: See TracTickets for help on using tickets.