From dd3b064aecb6e8343a5b3cbf2a91df769afa5ec4 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 28 Oct 2024 18:47:47 +0800 Subject: [PATCH] Sort the ancestors and descendants --- src/pages/status.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/status.jsx b/src/pages/status.jsx index 0989122e..91fcc417 100644 --- a/src/pages/status.jsx +++ b/src/pages/status.jsx @@ -321,6 +321,10 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) { const context = await contextFetch; const { ancestors, descendants } = context; + // Sort oldest first + ancestors.sort((a, b) => a.createdAt - b.createdAt); + descendants.sort((a, b) => a.createdAt - b.createdAt); + totalDescendants.current = descendants?.length || 0; const missingStatuses = new Set();