Themes: Fix stuck spinner and broken retry after canceling a theme update from the details overlay#12650
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
There was a problem hiding this comment.
Pull request overview
Fixes a UI regression in the Themes screen where canceling the filesystem credentials modal during a theme update from the details overlay leaves the overlay “Updating…” state stuck and breaks retry behavior, by ensuring both the overlay and grid-card notices are discoverable and independently restored.
Changes:
- Add
data-slugto the theme details overlay root so update/cancel handlers can target overlay notices consistently with grid cards. - Standardize the overlay update notice by adding the
update-messageclass and update the JS selectors accordingly. - Update
wp.updates.updateTheme()and thecredential-modal-cancelhandler to iterate over all matched notices and store/restore each notice’s original content independently; add a QUnit regression test covering overlay + grid notice restoration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/qunit/wp-admin/js/updates.js | Adds a regression test ensuring cancel restores both overlay and grid notices without cross-contamination. |
| src/wp-admin/themes.php | Marks the overlay update notice with update-message so it’s reachable by the same selectors as grid notices. |
| src/js/_enqueues/wp/updates.js | Fixes multi-notice handling by iterating notices when snapshotting/restoring original content; updates selectors to target both overlay and grid via data-slug. |
| src/js/_enqueues/wp/theme.js | Adds data-slug to the overlay root during render so JS can correctly scope notice selection in the overlay. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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. |
Canceling the filesystem-credentials modal after clicking "update now" inside the theme details overlay (Appearance → Themes → click a theme's screenshot → "update now") left the overlay's "Updating…" spinner stuck forever and broke the retry click, even though the same action from the theme grid card's own update link reset correctly. This was caused by two compounding bugs in
wp.updates: the overlay's notice had nodata-slug, so the cancel handler's selector never reached it at all; and even once reachable,updateTheme()stored each notice's original text via$notice.data('originaltext', $notice.html())on a combined multi-element jQuery collection, where both.data()and.html()only operate on the first element — so the overlay and the grid card ended up sharing one snapshot, and canceling could paste one notice's markup into the other instead of restoring each one's own content.This adds a
data-slugattribute to the theme details overlay root inDetails.render()(mirroring the existing convention already used by the grid card view) and marks the overlay's update notice with the sameupdate-messageclass the grid card uses, so both notices are reachable through one selector.updateTheme()and thecredential-modal-cancelhandler inupdates.jsnow iterate matched notices with.each()so each one's original text is read and restored independently instead of relying on jQuery's first-element-only.data()/.html()behavior across a multi-element collection.Verified with a browser harness driving the real compiled
wp.updatesscript through the exact scenario (open overlay → update → credentials required → cancel), confirming it reproduces the reported symptom on unfixed code and is resolved after the fix, plus manual verification in a running wp-env with a forcedFS_METHODand a faked theme update.Trac ticket: https://core.trac.wordpress.org/ticket/37669
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Root cause analysis, implementation, test coverage, and manual verification. Reviewed and directed by me throughout.
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.