fix: defer mobile gauge scroll until running render

Co-authored-by: sstidl <12804296+sstidl@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-09-12 13:31:28 +00:00 • committed by GitHub
parent 799eaca184
commit 62190e3d63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,6 +16,8 @@ const testState = {
state: INITIALIZING,
speedtest: null,
servers: [],
initialGaugeScrollPending: false,
initialGaugeScrollScheduled: false,
selectedServerDirty: false,
testData: null,
testDataDirty: false,
@ -81,8 +83,8 @@ function startButtonClickHandler() {
case READY:
case FINISHED:
testState.speedtest.start();
testState.initialGaugeScrollPending = true;
testState.state = RUNNING;
requestAnimationFrame(scrollInitialDownloadGaugeIntoView);
return;
case RUNNING:
testState.speedtest.abort();
@ -374,6 +376,21 @@ function startRenderingLoop() {
)
);
if (
testState.state === RUNNING &&
testState.initialGaugeScrollPending &&
!testState.initialGaugeScrollScheduled
) {
testState.initialGaugeScrollScheduled = true;
requestAnimationFrame(() => {
if (testState.state === RUNNING) {
scrollInitialDownloadGaugeIntoView();
}
testState.initialGaugeScrollPending = false;
testState.initialGaugeScrollScheduled = false;
});
}
// Show ping and jitter if data is available
pingAndJitter.forEach((e) =>
e.classList.toggle(