Fluentslider rapid-fire bug fix (#2778)

## Description:

Describe the PR.

Modified FluentSlider(my code) to split number input handle to visual
update(NumberInput) and dispatch value(NumberComplete)

updated the event flow to match them, will fix rapid-fire updates that
seemed to glitch bots out.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

jackochess
This commit is contained in:
VectorSophie
2026-01-04 13:07:13 +09:00
committed by GitHub
parent af0b8a8d50
commit 70767d2541
2 changed files with 19 additions and 5 deletions
+4 -1
View File
@@ -132,7 +132,10 @@ export class LocalServer {
if (!this.lobbyConfig.gameRecord) {
if (clientMsg.turnNumber % 100 === 0) {
// In singleplayer, only store hash every 100 turns to reduce size of game record.
this.turns[clientMsg.turnNumber].hash = clientMsg.hash;
const turn = this.turns[clientMsg.turnNumber];
if (turn) {
turn.hash = clientMsg.hash;
}
}
return;
}
+15 -4
View File
@@ -84,7 +84,7 @@ export class FluentSlider extends LitElement {
this.dispatchValueChange();
}
private handleNumberChange(e: Event) {
private handleNumberInput(e: Event) {
const target = e.target as HTMLInputElement;
let val = target.valueAsNumber;
if (isNaN(val)) {
@@ -93,11 +93,19 @@ export class FluentSlider extends LitElement {
if (val < this.min) val = this.min;
if (val > this.max) val = this.max;
this.value = val;
// Don't dispatch value change on every input - only on blur/enter
}
private handleNumberComplete() {
// Dispatch the value change when editing is complete
this.dispatchValueChange();
}
private handleNumberKeyDown(e: KeyboardEvent) {
if (e.key === "Enter") this.isEditing = false;
if (e.key === "Enter") {
this.isEditing = false;
this.handleNumberComplete();
}
}
private enableEditing() {
@@ -125,8 +133,11 @@ export class FluentSlider extends LitElement {
.min=${this.min}
.max=${this.max}
.valueAsNumber=${this.value}
@input=${this.handleNumberChange}
@blur=${() => (this.isEditing = false)}
@input=${this.handleNumberInput}
@blur=${() => {
this.isEditing = false;
this.handleNumberComplete();
}}
@keydown=${this.handleNumberKeyDown}
/>`
: html`<span