Skip to content

Commit

Permalink
Image cropping: skip making an API request if there are no changes to…
Browse files Browse the repository at this point in the history
… apply (#65384)

Co-authored-by: andrewserong <[email protected]>
Co-authored-by: ajlende <[email protected]>
Co-authored-by: annezazu <[email protected]>
  • Loading branch information
4 people committed Sep 17, 2024
1 parent 5b037d7 commit 1a23ed6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ export default function useSaveImage( {
} );
}

if ( modifiers.length === 0 ) {
// No changes to apply.
setIsInProgress( false );
onFinishEditing();
return;
}

apiFetch( {
path: `/wp/v2/media/${ id }/edit`,
method: 'POST',
Expand Down

0 comments on commit 1a23ed6

Please sign in to comment.