Skip to content

Commit 3217b88

Browse files
committed
fix: load 30 (max-limit) images per API call instead of 10
1 parent 3f5b6f4 commit 3217b88

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/extensionsIntegrated/phoenix-pro/browser-context/image-gallery.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const PHCODE_INTERNAL_ATTR = GLOBALS.PHCODE_INTERNAL_ATTR;
1010

1111
// image ribbon gallery cache, to store th e last query and its results
1212
const CACHE_EXPIRY_TIME = 168 * 60 * 60 * 1000; // 7 days
13-
const CACHE_MAX_IMAGES = 50; // max number of images that we store in the localStorage
13+
const CACHE_MAX_IMAGES = 60; // max number of images that we store in the localStorage
1414

1515
// initialized from config, defaults to true if not set
1616
let imageGallerySelected = config.imageGalleryState !== undefined ? config.imageGalleryState : true;
@@ -367,7 +367,7 @@ ImageRibbonGallery.prototype = {
367367
}
368368

369369
const apiUrl = `https://images.phcode.dev/api/images/search?` +
370-
`q=${encodeURIComponent(searchQuery)}&per_page=10&page=${page}&safe=true`;
370+
`q=${encodeURIComponent(searchQuery)}&per_page=30&page=${page}&safe=true`;
371371

372372
if (!append) {
373373
this._showLoading();
@@ -483,10 +483,10 @@ ImageRibbonGallery.prototype = {
483483
if (
484484
searchQuery === _imageGalleryCache.currentQuery &&
485485
cachedImages &&
486-
page <= Math.ceil(cachedImages.length / 10)
486+
page <= Math.ceil(cachedImages.length / 30)
487487
) {
488-
const startIdx = (page - 1) * 10;
489-
const endIdx = startIdx + 10;
488+
const startIdx = (page - 1) * 30;
489+
const endIdx = startIdx + 30;
490490
const pageImages = cachedImages.slice(startIdx, endIdx);
491491

492492
if (pageImages.length > 0) {

0 commit comments

Comments
 (0)