Repository navigation
Media: Show uploads after resetting the date filter to "All dates". - #15854
abhishekfdd wants to merge 1 commit into
Conversation
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.
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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 setsmonthnum/yeartonullinstead offalse, like the other "all" filters.Query.get()skipsnull, so the query drops the date args and observes the upload queue again.toolbar.js: the toolbar also refreshes on the selection'schange:uploading, so the button state no longer depends on the library reset cascade.media-frame-upload.js:handleSuccess()triggerschange:uploadingonce the refetch completes. Theuploading: falseset 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 alreadyfalse. The trigger sends the same event and argumentswp-plupload.jsdoes, 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:uploadingfired.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.jscovers 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.npm run grunt qunit:compiledincludes new toolbar tests.Manual, with at least one attachment from an older month:
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.