Skip to content

Media: Show uploads after resetting the date filter to "All dates". - #15854

Open
abhishekfdd wants to merge 1 commit into
WordPress:trunkfrom
abhishekfdd:fix/54839-media-date-filter-upload
Open

abhishekfdd wants to merge 1 commit into
WordPress:trunkfrom
abhishekfdd:fix/54839-media-date-filter-upload

Conversation

@abhishekfdd

Copy link
Copy Markdown

Uploads made after changing the media date filter could be hidden from the grid, and the Select/Insert button could stay disabled after the upload finished. Changes per comment #29:

  • date.js: "All dates" now sets monthnum/year to null instead of false, like the other "all" filters. Query.get() skips null, so the query drops the date args and observes the upload queue again.
  • toolbar.js: the toolbar also refreshes on the selection's change:uploading, so the button state no longer depends on the library reset cascade.
  • media-frame-upload.js: handleSuccess() triggers change:uploading once the refetch completes. The uploading: false set stays silent, so the details view still sees it before the refetch re-renders. A non-silent set wouldn't work here because the value is already false. The trigger sends the same event and arguments wp-plupload.js does, before the queue reset.

This also fixes a regression from [64588]: after a client-side upload in the Post frame, the attachment display settings (Size dropdown) never updated, because no change:uploading fired.

Not changed: with a specific month selected, an upload from another month is now selectable and insertable but still isn't shown in the grid. The tests don't assert either way, pending discussion on the ticket.

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

Testing

Automated:

  • npm run test:e2e -- tests/e2e/specs/media-date-filter-upload.test.js covers both upload paths: client-side (cross-origin isolated Chromium) and classic (Document-Isolation-Policy header removed). On trunk 6 of 10 tests fail. With this change all 10 pass.
  • The same spec passes on the classic path in WebKit.
  • npm run grunt qunit:compiled includes new toolbar tests.

Manual, with at least one attachment from an older month:

  1. Media Library grid: select the older month, then "All dates", then upload. The file appears.
  2. Post editor > Image block > Media Library: same steps. The file appears and "Select" is enabled.
  3. Select only the older month and upload. "Select" is enabled and inserts the file.
  4. Repeat in Firefox or Safari to cover classic (plupload) uploads.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code, Claude
Model(s): Claude Opus 5.5
Used for: Tracing the root cause in the media JS, reproducing the bug with Playwright, implementing the fix, writing the e2e and QUnit tests, and drafting the Trac comment and this description. I reviewed every change, ran the tests locally, and verified the behavior myself.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Choosing a month and then "All dates" set `monthnum` and `year` to `false` instead of `null`. The query kept both keys, stopped observing the upload queue, and new uploads did not appear in the grid. Use `null`, as the other "all" filters do.

The toolbar now also refreshes when an attachment in the selection changes its `uploading` state, so the insert/select button is enabled once an upload finishes, even when the current query does not show it. Client-side uploads clear `uploading` silently before refetching the attachment, so they now trigger `change:uploading` once the refetch completes, as classic uploads do.

See #54839.
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props abhishekfdd.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant