From e5aff036206c531baa2b2439652e3bc9d21cbf5c Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 3 Jan 2026 21:52:49 +0100 Subject: [PATCH] scroll after filling --- frontend/src/ts/pages/tribe.ts | 5 ++--- frontend/src/ts/test/result.ts | 5 +++-- frontend/src/ts/tribe/tribe-chat.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/ts/pages/tribe.ts b/frontend/src/ts/pages/tribe.ts index c2ab5a60d..15a345acd 100644 --- a/frontend/src/ts/pages/tribe.ts +++ b/frontend/src/ts/pages/tribe.ts @@ -24,10 +24,9 @@ export const page = new Page({ }, beforeShow: async () => { if (TribeState.isInARoom()) { - TribeChat.fill("lobby"); - setTimeout(() => { + void TribeChat.fill("lobby").then(() => { TribeChat.scrollChat(); - }, 50); + }); } }, afterShow: async () => { diff --git a/frontend/src/ts/test/result.ts b/frontend/src/ts/test/result.ts index 0c7be5a6a..410bc204b 100644 --- a/frontend/src/ts/test/result.ts +++ b/frontend/src/ts/test/result.ts @@ -1149,8 +1149,9 @@ export async function update( duration: Misc.applyReducedMotion(125), }); - TribeChat.scrollChat(); - TribeChat.fill("result"); + void TribeChat.fill("result").then(() => { + TribeChat.scrollChat(); + }); const room = TribeState.getRoom(); if (room?.users) { diff --git a/frontend/src/ts/tribe/tribe-chat.ts b/frontend/src/ts/tribe/tribe-chat.ts index 68c3f2762..463689105 100644 --- a/frontend/src/ts/tribe/tribe-chat.ts +++ b/frontend/src/ts/tribe/tribe-chat.ts @@ -115,10 +115,10 @@ export function reset(where: "lobby" | "result"): void { } } -export function fill(where: "lobby" | "result"): void { +export async function fill(where: "lobby" | "result"): Promise { reset(where); for (let i = 0; i < chatHistory.length; i++) { - void displayMessage(i, where); + await displayMessage(i, where); } }