fix: enforce elapsed loading display minimum after timer wakes

This commit is contained in:
2026-09-05 19:12:50 +08:00
parent 73d7826fbe
commit 4414e1bcab
2 changed files with 59 additions and 1 deletions
@@ -81,7 +81,11 @@ export class LocalPlatformLogin extends Component {
waitForMinimumDisplay: async () => {
await firstDraw;
const drawnAt = this.required(this.firstDrawAt, 'loading first draw');
await this.delay(Math.max(0, MINIMUM_LOADING_MS - (performance.now() - drawnAt)));
let remaining = MINIMUM_LOADING_MS - (performance.now() - drawnAt);
while (remaining > 0) {
await this.delay(remaining);
remaining = MINIMUM_LOADING_MS - (performance.now() - drawnAt);
}
this.record({ kind: 'minimum-display-ready', data: performance.now() - drawnAt });
},
createSocket: url => new WebSocket(url), record: event => this.record(event),