Make WordPress Core

Opened 21 months ago

Last modified 4 days ago

#61057 assigned defect (bug)

Media Library not showing new uploads when filtering by date

Reported by: vertisoft's profile vertisoft Owned by: antpb's profile antpb
Milestone: Future Release Priority: normal
Severity: normal Version: 6.5
Component: Media Keywords: has-patch
Focuses: Cc:

Description

Description

The issue can be reproduced in the media library, in grid mode. As soon as the value of the date filter is modified, new uploads will not be displayed in the grid until the user refreshes the page or modifies the date filter.

This issue appears to be similar to: https://core.trac.wordpress.org/ticket/50025

Environment

  • WordPress: 6.5.3-alpha-58036
  • PHP: 8.2.18
  • Server: Apache
  • Database: mysqli (Server: 5.7.44 / Client: mysqlnd 8.2.18)
  • Browser: Chrome 124.0.0.0 (Windows 10/11)
  • Theme: Twenty Twenty-Four 1.1
  • MU-Plugins: Aucune activée
  • Plugins:
    • WordPress Beta Tester 3.5.5

Steps to Reproduce

  1. Use grid mode in Media Library
  2. Filter by a date (eg. April 2024)
  3. Toggle back to "All Dates"
  4. Upload a media by drag-and-dropping an image into the grid

The new image will not appear in the grid unless I refresh the page or select the current date in the date filter (eg. April 2024)

Expected Results

There should be some visual feedback when uploading the media. Normally, the image should appear in the grid, and it should display a loading bar while it is being uploaded.

Actual Results

There is no visual feedback when uploading the media. The image does not appear in the grid at all, unless I refresh the page or filter the grid by the current date.

Attachments (5)

Step 1.png (15.0 KB) - added by vertisoft 21 months ago.
Step 2.png (18.2 KB) - added by vertisoft 21 months ago.
Step 3.png (19.4 KB) - added by vertisoft 21 months ago.
Step 4.png (28.4 KB) - added by vertisoft 21 months ago.
Step 5.png (23.5 KB) - added by vertisoft 21 months ago.

Download all attachments as: .zip

Change History (15)

@vertisoft
21 months ago

@vertisoft
21 months ago

@vertisoft
21 months ago

@vertisoft
21 months ago

@vertisoft
21 months ago

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


21 months ago

#2 @antpb
21 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 6.6
  • Owner set to antpb
  • Status changed from new to assigned

This relates a bit to the work happening in https://core.trac.wordpress.org/ticket/54091

I'm going to look into if this can be solved alongside it. Moving to 6.6 to investigate.

A potential partial solution mentioned by @joedolson was that we could maybe solve this for most people by initializing if the current pagination count is less than 81 items. In that case, we could reinitialize the collection safely.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


20 months ago

#4 @antpb
20 months ago

  • Milestone changed from 6.6 to 6.7

As the other related issue has been punted to 6.7 we're going to need to do the same here. Moving to 6.7 to allow more time

#5 @dorshiff
20 months ago

I'm working on it as part of the contributor day.

#6 @nithins53
17 months ago

I'm also able to reproduce the issue with WordPress 6.6.1.

#7 @amin7
17 months ago

As per testing instructions, I am also able to reproduce the issue on WordPress 6.6.1.
Here is the process and result, https://d.pr/v/GGefxc

#8 @peterwilsoncc
16 months ago

  • Milestone changed from 6.7 to Future Release

As the related issue, #54091, has been moved off the 6.7 milestone, this one will need to be moved too.

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


4 days ago
#9

  • Keywords has-patch added; needs-patch removed

## Changes

This PR implements two minimal changes to resolve the issue:

  1. Add date filter functions (src/js/media/models/attachments.js)

Added year and monthnum filter functions to the static Attachments.filters object (lines 598-657). These functions validate attachments against year/month filter criteria

### 2. Updated allowed args whitelist (src/js/media/models/query.js)
Added 'year' and 'monthnum' to the allowed args array so Query collections observe the upload queue when date filters are active.

Trac ticket: https://core.trac.wordpress.org/ticket/61057

#10 @rutviksavsani
4 days ago

Hi @joedolson and @antpb

I have raised a PR here as well for the attachments upload process by initialising the filters. Let me know the approach looks good to you.

Note: See TracTickets for help on using tickets.