From 2b095bd32a5afbe61d3ee4c63e44f29f686aeffc Mon Sep 17 00:00:00 2001 From: PartMan <47669599+PartMan7@users.noreply.github.com> Date: Tue, 3 Sep 2024 23:32:37 +0530 Subject: [PATCH] fix: Pass this context correctly to updateTeamList (#2277) --- play.pokemonshowdown.com/js/client-teambuilder.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/play.pokemonshowdown.com/js/client-teambuilder.js b/play.pokemonshowdown.com/js/client-teambuilder.js index be22d105f3..658eafd74d 100644 --- a/play.pokemonshowdown.com/js/client-teambuilder.js +++ b/play.pokemonshowdown.com/js/client-teambuilder.js @@ -3246,21 +3246,21 @@ }, searchChange: function (e) { var DEBOUNCE_THRESHOLD_TEAMS = 500; + var searchVal = e.currentTarget.value; + var self = this; function updateTeamList() { // 91 for right CMD / 93 for left CMD / 17 for CTL if (e.keyCode !== 91 && e.keyCode !== 93 && e.keyCode !== 17) { - this.curSearchVal = searchVal; + self.curSearchVal = searchVal; } - this.updateTeamList(); + self.updateTeamList(); } // If the user has a lot of teams, search is debounced to // ensure this isn't called too frequently while typing if (Storage.teams.length > DEBOUNCE_THRESHOLD_TEAMS) { if (this.searchTimeout) clearTimeout(this.searchTimeout); - - var searchVal = e.currentTarget.value; - this.searchTimeout = setTimeout(updateTeamList.bind(this), 400); + this.searchTimeout = setTimeout(updateTeamList, 400); } else updateTeamList(); },