Skip to content

Themes: Fix stuck spinner and broken retry after canceling a theme update from the details overlay#12650

Open
irozum wants to merge 2 commits into
WordPress:trunkfrom
irozum:fix/37669-shiny-updates-cancel-credentials-modal
Open

Themes: Fix stuck spinner and broken retry after canceling a theme update from the details overlay#12650
irozum wants to merge 2 commits into
WordPress:trunkfrom
irozum:fix/37669-shiny-updates-cancel-credentials-modal

Conversation

@irozum

@irozum irozum commented Jul 23, 2026

Copy link
Copy Markdown

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 no data-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-slug attribute to the theme details overlay root in Details.render() (mirroring the existing convention already used by the grid card view) and marks the overlay's update notice with the same update-message class the grid card uses, so both notices are reachable through one selector. updateTheme() and the credential-modal-cancel handler in updates.js now 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.updates script 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 forced FS_METHOD and 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.

Copilot AI review requested due to automatic review settings July 23, 2026 01:42
@github-actions

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. You can also manually ask me to refresh this list by adding the props-bot label.

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

Props irozum.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-slug to 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-message class and update the JS selectors accordingly.
  • Update wp.updates.updateTheme() and the credential-modal-cancel handler 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.

@github-actions

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.

2 participants