From 4c527ec4c410c3e5f798e23680cb7af00bfea513 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt-Bilkenroth Date: Fri, 10 Nov 2023 19:59:46 +0100 Subject: [PATCH] small optimization --- script.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 617a79f..1fd6e73 100644 --- a/script.js +++ b/script.js @@ -248,8 +248,7 @@ $(document).ready(async function() { if (hashtagsArray.length > 0 && hashtagsArray[0] !== '') { const allPosts = await Promise.all(hashtagsArray.map(hashtag => fetchPosts(serverUrl, hashtag))); updateWall(allPosts.flat()); - const allSlides = await Promise.all(hashtagsArray.map(hashtag => fetchPosts(serverUrl, hashtag))); - updateCarousel(slides, allSlides.flat()); + updateCarousel(slides, allPosts.flat()); setTimeout(async function() { showCarousel(); }, duration) setInterval(async function() { @@ -257,8 +256,7 @@ $(document).ready(async function() { let updated = updateWall(newPosts.flat()); if ( updated > 0 ) { hideCarousel() - const newSlides = await Promise.all(hashtagsArray.map(hashtag => fetchPosts(serverUrl, hashtag))); - updateCarousel(slides, newSlides.flat()); + updateCarousel(slides, newPosts.flat()); setTimeout(async function() { showCarousel(); }, duration) } }, refresh);