From 96da377e4e074d31ffb8661836f7b4e45f79ab53 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 26 Apr 2022 04:00:18 +0300 Subject: [PATCH] frontend: fix error toast when the server returns no messages --- frontend/src/stores.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/stores.js b/frontend/src/stores.js index c171d44..f433b83 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -176,7 +176,9 @@ class MessageStore extends Store { const oldestMessage = this.value[0]; const endpoint = oldestMessage ? `channels/${this.channelId}/messages/?before=${oldestMessage.id}` : `channels/${this.channelId}/messages`; const res = await request("GET", apiRoute(endpoint), true, null); - if (res.success && res.ok && res.json && res.json.length > 0) { + if (res.success && res.ok && res.json) { + if (res.json.length < 1) + return; if (beforeCommitToStore) beforeCommitToStore(res.json); res.json.reverse();