Repository navigation
Conversation
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>
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 callssetIsLoading( false ).Note
This covers more than the 500 in the issue: the request uses
parse: false, andapiFetchrejects 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 bothoffload_imagesandrollback_images, a rejected status request sets the error and clearsisLoading,loadingSyncandloadingRollback. Both cases fail ondevelopment.QA
On a connected site, start Transfer back from Optimole (or an offload) in
WP Admin → Optimole → Settings → Image Storage.In the browser dev tools, block the
number_of_images_and_pagesrequest (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)developmentsourcewp-scripts lint-js assets/src🤖 Generated with Claude Code