From db24a041aaa9bba2472ac10f2dfa462b4907b455 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 8 Dec 2023 22:03:23 +0000 Subject: [PATCH] Fix the ordering in rageshakes (#12020) * Fix the ordering in rageshakes Fixes https://github.com/vector-im/element-web/issues/26715 * Update src/rageshake/rageshake.ts Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --------- Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> --- src/rageshake/rageshake.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rageshake/rageshake.ts b/src/rageshake/rageshake.ts index 87e9752e80..261cef51f5 100644 --- a/src/rageshake/rageshake.ts +++ b/src/rageshake/rageshake.ts @@ -385,7 +385,8 @@ export class IndexedDBLogStore { return; } const newLines = cursor.value.lines; - lines += newLines; + // The query returns log chunks in reverse time order, so prepend this new chunk to the buffer. + lines = newLines + lines; sizeSoFar += newLines.length; // If we have now exceeded the size limit, stop.