From 80ab321103c30ad2daded37903c8f56a5dc7ed84 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sat, 17 Sep 2022 23:44:46 +0300 Subject: [PATCH] further optimize message rendering --- frontend/src/components/Messages.svelte | 4 ++-- frontend/src/stores.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Messages.svelte b/frontend/src/components/Messages.svelte index 2a2edad..a2b3974 100644 --- a/frontend/src/components/Messages.svelte +++ b/frontend/src/components/Messages.svelte @@ -84,9 +84,9 @@
{#each $messages as message (message.id)} - {#if message._showDateMarkerAbove} + {#if message._aboveDateMarker}
- { new Intl.DateTimeFormat(getItem("ui:locale"), { month: "long", day: "numeric", year: "numeric" }).format(message._createdAtDate) } + { message._aboveDateMarker }
{/if} diff --git a/frontend/src/stores.js b/frontend/src/stores.js index 4523f0a..63e3136 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -152,7 +152,7 @@ class MessageStore extends Store { message._mentions = false; message._editable = false; message._clumped = false; - message._showDateMarkerAbove = false; + message._aboveDateMarker = null; if (userInfoStore.value && message.content.includes("@" + userInfoStore.value.username)) { message._mentions = true; } @@ -163,7 +163,7 @@ class MessageStore extends Store { message._clumped = true; } if (previous && (previous._createdAtDateString !== message._createdAtDateString)) { - message._showDateMarkerAbove = true; + message._aboveDateMarker = new Intl.DateTimeFormat(getItem("ui:locale"), { month: "long", day: "numeric", year: "numeric" }).format(message._createdAtDate); } return message; }