From 699eb4df2fe9566a046c1c68fdc5b521ca40671a Mon Sep 17 00:00:00 2001 From: dimden Date: Sun, 17 Sep 2023 12:34:19 +0300 Subject: [PATCH] show empty when errored --- layouts/tweet/script.js | 3 ++- scripts/apis.js | 1 + scripts/tweetviewer.js | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/layouts/tweet/script.js b/layouts/tweet/script.js index 28a310d9..8faad906 100644 --- a/layouts/tweet/script.js +++ b/layouts/tweet/script.js @@ -133,7 +133,8 @@ async function updateReplies(id, c) { return; } tl = tlData.value; - tweetLikers = tweetLikersData.value; + if(tweetLikersData.value) tweetLikers = tweetLikersData.value; + else tweetLikers = { list: [], cursor: undefined }; loadingNewTweets = false; } catch(e) { loadingNewTweets = false; diff --git a/scripts/apis.js b/scripts/apis.js index f1e45f52..2315200b 100644 --- a/scripts/apis.js +++ b/scripts/apis.js @@ -3322,6 +3322,7 @@ const API = { loadingLikers[id].listeners.forEach(l => l[0]({ list: [], cursor: undefined })); delete loadingLikers[id]; } + debugLog('tweet.getLikers', 'end', id, { list: [], cursor: undefined, data }); return resolve({ list: [], cursor: undefined }); } list = list.entries; diff --git a/scripts/tweetviewer.js b/scripts/tweetviewer.js index 05d53938..0bb9fe12 100644 --- a/scripts/tweetviewer.js +++ b/scripts/tweetviewer.js @@ -176,7 +176,8 @@ class TweetViewer { for(let u in tl.users) { this.users[u] = tl.users[u]; } - tweetLikers = tweetLikersData.value; + if(tweetLikersData.value) tweetLikers = tweetLikersData.value; + else tweetLikers = { list: [], cursor: undefined }; this.loadingNewTweets = false; document.getElementsByClassName('timeline-more')[0].innerText = LOC.load_more.message; } catch(e) {