Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): stop rendering a literal "0" where a chat's time belongs (#857)

Yudhi Armyndharis90387fcc434b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index efae0eef7..54ccba88a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
+- **The chat list no longer shows a stray `0` next to every conversation.** Each row in the Chats
+ sidebar rendered a literal `0` where the last message's time belongs, on every chat. A conversation
+ with no messages reports a timestamp of zero, and the check that was meant to hide the time in that
+ case ended up displaying the zero itself. The time is now simply omitted when there is no last
+ message, as intended. The unread-count badge was unaffected.
+
- **A message send that is retried after a recipient-address change is now recorded in the log.** When
whatsapp-web.js reports that a contact's cached address is stale, the gateway re-resolves the address
and sends again. That retry was silent, so in the case where the engine reports a failure for a
diff --git a/dashboard/src/pages/Chats.tsx b/dashboard/src/pages/Chats.tsx
index 034b31a3d..49e87470f 100644
--- a/dashboard/src/pages/Chats.tsx
+++ b/dashboard/src/pages/Chats.tsx
@@ -953,7 +953,12 @@ export function Chats() {
<span className="chat-item-name" title={chat.name || chat.id}>
{chat.name || chat.id.split('@')[0]}
</span>
- {chat.timestamp && <span className="chat-item-time">{formatChatTime(chat.timestamp)}</span>}
+ {/* Ternary, not `&&`: a chat with no messages carries timestamp 0, and React
+ renders the number 0 as text — so `0 && <span/>` painted a literal "0"
+ where the time belongs, on every such row. */}
+ {chat.timestamp ? (
+ <span className="chat-item-time">{formatChatTime(chat.timestamp)}</span>
+ ) : null}
</div>
<div className="chat-item-bottom">
<span className="chat-item-snippet" title={formatLastMessageSnippet(chat)}>