From aaded1d17e7a54ee6bd66563f7bd734a7ccd4883 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Tue, 30 Nov 2021 18:06:43 +0000 Subject: [PATCH] Media: Featured image modal loads only selected image when infinite scroll is disabled. Follow-up to [52167], which partially fixed a bug introduced in [50829] that caused media modal to only load the selected image. This commit adds additional checks to ensure infinite scroll is disabled. Follow-up to [50829], [52167]. Props dariak, joedolson, szaqal21. Fixes #53765. git-svn-id: https://develop.svn.wordpress.org/trunk@52287 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/media/controllers/featured-image.js | 2 +- src/js/media/controllers/replace-image.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/media/controllers/featured-image.js b/src/js/media/controllers/featured-image.js index 83c39f9936..e05b377be3 100644 --- a/src/js/media/controllers/featured-image.js +++ b/src/js/media/controllers/featured-image.js @@ -117,7 +117,7 @@ FeaturedImage = Library.extend(/** @lends wp.media.controller.FeaturedImage.prot selection.reset( attachment ? [ attachment ] : [] ); - if ( library.hasMore() ) { + if ( ! infinite_scrolling && library.hasMore() ) { library.more(); } } diff --git a/src/js/media/controllers/replace-image.js b/src/js/media/controllers/replace-image.js index d042ec3c07..858e84c2d5 100644 --- a/src/js/media/controllers/replace-image.js +++ b/src/js/media/controllers/replace-image.js @@ -104,7 +104,7 @@ ReplaceImage = Library.extend(/** @lends wp.media.controller.ReplaceImage.protot selection.reset( attachment ? [ attachment ] : [] ); - if ( library.hasMore() ) { + if ( ! infinite_scrolling && library.getTotalAttachments() == 0 && library.hasMore() ) { library.more(); } }