Make WordPress Core

Opened 4 years ago

Last modified 7 weeks ago

#57489 new defect (bug)

Media items, which have already been uploaded, disappear when the upload dialog box is closed and then opened again.

Reported by: shamayel007 Owned by:
Priority: normal Milestone: Awaiting Review
Component: Media Version: 6.1.1
Severity: major Keywords: has-screenshots has-test-info reporter-feedback has-patch has-unit-tests
Cc: Focuses: javascript

Description

I followed the following steps and got this error:

1) Freshly created a new WordPress site.

https://i.paste.pics/L1SUI.png

2) Created a new page and opened it in the block editor

https://i.paste.pics/L1SW2.png

3) Added a new gallery block

https://i.paste.pics/L1SY2.png

4) Clicked "Media Library"

https://i.paste.pics/L1SYB.png

5) Uploaded new images

https://i.paste.pics/L1SYG.png

6) Uploaded 20 images

https://i.paste.pics/L1SYQ.png

7) Closed the dialogue box and opened it back up.

https://i.paste.pics/L1T7T.png

8) Selected a few images and clicked "Create a new gallery"

https://i.paste.pics/L1T81.png

9) After it went to the "Edit Gallery" window, I closed it by clicking the cross button

https://i.paste.pics/L1T8W.png

10) Clicked "Media Library" again to create the Gallery block

https://i.paste.pics/L1TAA.png

11) Selected photos again and clicked "Create a new gallery"

https://i.paste.pics/L1TBI.png

12) When it again went to the Edit Gallery window, I clicked "Add to gallery"

https://i.paste.pics/L1TCL.png

13) Shows "No media items found", even though I have a lot of images uploaded.

https://i.paste.pics/L1TDG.png

Here are my setup details:
i) OS: Ubuntu 20.04.5 LTS
ii) Using Local by Flywheel
iii) Web server: Nginx
iv) PHP Version: 8.1.9
v) MySQL: 8.0.16
vi) WordPress: 6.1.1
vii) Browser: Opera

Attachments (1)

13_Shows %22No items found%22 even though there are a lot of items already uploaded.png​ (40.6 KB ) - added by shamayel007 4 years ago.
Shows "No media items found" even when a lot of images are already uploaded.

Download all attachments as: .zip

Change History (9)

@shamayel007
4 years ago

Shows "No media items found" even when a lot of images are already uploaded.

This ticket was mentioned in ​Slack in #core-test by ironprogrammer. ​View the logs.


4 years ago

#2 @ironprogrammer
4 years ago

  • Keywords needs-testing has-testing-info added; needs-patch removed

Thank you for the detailed report, @shamayel007! I'm marking this ticket for reproduction testing.

#3 @dariak
4 years ago

Reproduction Report

I have been trying to reproduce the issue, and probably we need to clarify the expected result and behaviour. The behaviour, which I got, is also not clear to me.

Environment

  • OS: macOS 13.1
  • Web Server: Nginx
  • PHP: 7.4.1
  • WordPress: 6.1.1
  • Browser: Chrome 109
  • Theme: Twenty Twenty-Two

Active Plugins: none
(I used Local to build a clean WordPress environment).

Actual Results

  • Go to create new page.
  • Insert Gallery block.
  • Click Media Library.
  • Upload 3 JPEG images.
  • Choose 1 image and click "Create a new gallery".
  • Close the popup by clicking X.
  • Click Media Library in the Gallery block -> you are in "Edit gallery", which is empty (I would expect it to be empty).
  • Click "Add to gallery" in the left side menu -> you see Media library with 3 uploaded images.
  • Choose 1 image and click "Create a new gallery".
  • Close the popup by clicking X.
  • Click Media Library in the Gallery block -> you are in "Edit gallery", which is empty (I would expect it to be empty).
  • Click "Add to gallery" in the left side menu -> you see Media library with only 2 uploaded images.
  • Choose 2 images and click "Create a new gallery".
  • Close the popup by clicking X.
  • Click Media Library in the Gallery block -> you are in "Edit gallery", which is empty (I would expect it to be empty).
  • Click "Add to gallery" in the left side menu -> you see Media library which is empty.

I suppose this is the problem.

  • However, now close the popup by clicking X.
  • Click Media Library in the Gallery block -> you are in "Edit gallery", which is empty (I would expect it to be empty).
  • Click "Add to gallery" in the left side menu -> you see Media library with 3 images.
Last edited 4 years ago by dariak (previous) (diff)

#4 @wordpressdotorg
17 months ago

  • Keywords has-test-info added; has-testing-info removed

#5 @r1k0
9 months ago

  • Keywords reporter-feedback added; needs-testing removed

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 7.0-alpha-61507
  • PHP: 8.3.30
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 144.0.0.0
  • OS: Linux
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1

Steps to Reproduce

  • The same steps as the reporter above.

Actual Results

  1. ❌ Error condition doesn't occur (not reproducible).
  2. The media library is not empty.

Additional Notes

  • The bug as described by the reporter doesn't appear.
  • When you follow the steps described by @dariak, the media library becomes empty momentarily. Then it's not after closing and opening the modal.

Supplemental Artifacts

ScreenCast:
​https://files.catbox.moe/m0h38t.webm

Bonus video of steps as described by @dariak:
​https://files.catbox.moe/c0dco3.webm

Last edited 9 months ago by r1k0 (previous) (diff)

#6 @r1k0
9 months ago

This ticket needs more info from the reporter, as this bug seems to be inconsistent. I was also having problems reproducing the another bug you reported 57488. Which also happens when you upload images through media library on the gallery block. I'm inclined to think this is an issue with the media library modal as a whole or this only happens when accessed through gallery block. But this definately needs to additional investigation.

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


4 months ago
#7

  • Keywords has-patch has-unit-tests added

Media: Reset gallery modal state when abandoning a new gallery

## What?

  • clear the transient gallery-edit, gallery, and gallery-library selections when the media modal closes during a new gallery flow
  • add a QUnit regression that covers closing an abandoned gallery before insertion

## Why?
The gallery add state excludes attachments already staged in gallery-edit. When the modal is closed before the gallery is inserted, that staged selection leaks into the next create-gallery flow and can make the media library appear empty.

## Testing

  • php vendor/bin/phpcbf --standard=phpcs.xml.dist src/js/media/views/frame/post.js tests/qunit/wp-admin/js/media/post-frame.js
  • php vendor/bin/phpcs --standard=phpcs.xml.dist src/js/media/views/frame/post.js tests/qunit/wp-admin/js/media/post-frame.js
  • npm run grunt -- jshint:corejs
  • npx playwright test --config tests/qunit/playwright.config.js
  • npm run typecheck:js

#8 @arkaprabhachowdhury
7 weeks ago

Opened [PR #12297](​https://github.com/WordPress/wordpress-develop/pull/12297) to address this ticket. Media: Reset gallery modal state when abandoning a new gallery What? - clear the transient gallery-edit, gallery, and gallery-library selections when the media modal closes during a new gallery flow - add a QUnit regression that covers closing an abandoned gallery before insertion Why? The gallery add state excludes attachments already staged in gallery-edit. When the modal is closed before the gallery is inserted, that staged selection leaks into the next create-gallery flow and can mak The PR includes focused regression coverage, and its validation details are recorded in the PR description.

I picked this up because the ticket describes a concrete core behavior or edge case that remains relevant in current WordPress. The proposed change is intentionally scoped to the ticket and is submitted here for code review, with the technical discussion remaining on this ticket.

Note: See TracTickets for help on using tickets.