Skip to content

fix: re-enable the dashboard when the Image Storage status request fails - #1175

Open
selul wants to merge 1 commit into
developmentfrom
bugfix/1109
Open

selul wants to merge 1 commit into
developmentfrom
bugfix/1109

Conversation

@selul

@selul selul commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Related issue: #1109

When the Image Storage progress request failed, the settings controls stayed disabled until the page was reloaded. callSync() sets the global loading flag before it polls; the failure handler cleared the sync and rollback flags and showed the error, but never cleared that flag. It now does.

What changed

  • callSync() (assets/src/dashboard/utils/api.js) — the .catch() also calls setIsLoading( false ).

Note

This covers more than the 500 in the issue: the request uses parse: false, and apiFetch rejects on any non-2xx status or network error, so every failure reached this handler. The global flag also disabled other screens (Compression, Cloud Library, the header spinner).

Tests

  • assets/src/dashboard/utils/__tests__/api.test.js (new, the first Jest test for the dashboard API module, with @wordpress/* mocked): for both offload_images and rollback_images, a rejected status request sets the error and clears isLoading, loadingSync and loadingRollback. Both cases fail on development.

QA

  1. On a connected site, start Transfer back from Optimole (or an offload) in WP Admin → Optimole → Settings → Image Storage.

  2. In the browser dev tools, block the number_of_images_and_pages request (Network → right click → Block request URL), or make it fail.

    Expect: the error notice appears, and the Image Storage options and the Save button are usable again without a reload.

Verification (head ce8b7250)

Check Result
Jest, full suite PASS: 235 tests (2 new)
New tests on the development source FAIL (2 of 2)
wp-scripts lint-js assets/src PASS

🤖 Generated with Claude Code

callSync() sets the global loading flag before it polls the transfer
progress. apiFetch rejects on any non-2xx response or network error, and
the rejection handler cleared the sync and rollback flags but not the
global one, so the Image Storage controls (and the other screens that
read it) stayed disabled after a failed poll.

Adds the first Jest test for the dashboard API module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pirate-bot

Copy link
Copy Markdown
Collaborator

Plugin build for ce8b725 is ready 🛎️!

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