Make WordPress Core

Opened 2 years ago

Last modified 5 weeks ago

#61057 assigned defect (bug)

Media Library not showing new uploads when filtering by date

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

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 2 years ago.
Step 2.png (18.2 KB ) - added by vertisoft 2 years ago.
Step 3.png (19.4 KB ) - added by vertisoft 2 years ago.
Step 4.png (28.4 KB ) - added by vertisoft 2 years ago.
Step 5.png (23.5 KB ) - added by vertisoft 2 years ago.

Download all attachments as: .zip

Change History (16)

@vertisoft
2 years ago

@vertisoft
2 years ago

@vertisoft
2 years ago

@vertisoft
2 years ago

@vertisoft
2 years ago

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


2 years ago

#2 @antpb
2 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review6.6
  • Owner set to antpb
  • Status newassigned

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.


2 years ago

#4 @antpb
2 years ago

  • Milestone 6.66.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
2 years ago

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

#6 @nithins53
2 years ago

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

#7 @amin7
2 years 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
2 years ago

  • Milestone 6.7Future 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.


8 months 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
8 months 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.

@wildworks commented on PR #10745:


5 weeks ago
#11

@irozum I apologize if I am mistaken, but it appears to me that your review was generated solely by AI and has not been verified. Please post responsibly in accordance with AI guidelines.

Note: See TracTickets for help on using tickets.