Ne pas raffraîchir si le text ne change pas

This commit is contained in:
Vincent Vandemeulebrouck 2022-08-27 22:45:26 +02:00
parent 049b23c666
commit 6e361a5531
1 changed files with 10 additions and 7 deletions

View File

@ -432,14 +432,17 @@ export class RdDActorSheet extends ActorSheet {
}
})
.keyup(async event => {
this.options.recherche = this._optionRecherche(event.currentTarget)
if (this.timerRecherche) {
clearTimeout(this.timerRecherche);
const nouvelleRecherche = this._optionRecherche(event.currentTarget);
if (this.options.recherche?.text != nouvelleRecherche?.text){
this.options.recherche = nouvelleRecherche;
if (this.timerRecherche) {
clearTimeout(this.timerRecherche);
}
this.timerRecherche = setTimeout(() => {
this.timerRecherche = undefined;
this.render(true);
}, 500);
}
this.timerRecherche = setTimeout(() => {
this.timerRecherche = undefined;
this.render(true);
}, 500);
})
.change(async event =>
this.options.recherche = this._optionRecherche(event.currentTarget)