From 6339b66d7bc6566ce54655fc69cb441a1ed52f09 Mon Sep 17 00:00:00 2001 From: Anton Roslund Date: Sat, 29 Mar 2025 08:18:31 +0100 Subject: [PATCH] sort messages --- static/js/messages.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/static/js/messages.js b/static/js/messages.js index 5afc74f..b97af28 100644 --- a/static/js/messages.js +++ b/static/js/messages.js @@ -37,6 +37,9 @@ document.addEventListener("DOMContentLoaded", async function () { new Map(data.text_messages.map(msg => [msg.packet_id, msg])).values() ); + // Sort the messages, for some reason with multiple mqtt gateways they are unsorted. + state.messages.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); + // fetch node info for(const message of state.messages){ await fetchNodeInfo(message.to);