From bdc1e9d9c64c60f7ed7316456faf027a4d8828ba Mon Sep 17 00:00:00 2001 From: itepechi <72330683+itepechi@users.noreply.github.com> Date: Mon, 6 Nov 2023 08:27:14 +0900 Subject: [PATCH] If refactoring is so good, why isn't there refactoring 2? --- src/components/search/search.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/search/search.js b/src/components/search/search.js index de7578c4..61a4dae2 100644 --- a/src/components/search/search.js +++ b/src/components/search/search.js @@ -168,7 +168,14 @@ const Search = { skipMediaSearch = true } } - this.loadedInitially = true + + if ( + !loadedInitially && + Object.values(data).some((result) => result.length > 0) + ) { + // Show results on the first meaningful response + this.loadedInitially = true + } if (searchType === 'statuses') { // Offset from whatever we already have @@ -179,19 +186,10 @@ const Search = { this.mediaOffset = this.media.length this.lastMediaFetchCount = this.media.length - oldMediaLength } - - if (searchTypes.length > 1) { - for (const value of Object.values(data)) { - if (value.length) { - // Show results on the first meaningful response - this.loading = false - break - } - } - } } this.lastQuery = query + this.loadedInitially = true this.loading = false }, resultCount (tabName) {