Skip to content

Commit ea55e07

Browse files
committed
Fix potential issues with Guide search
1 parent a8b007d commit ea55e07

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

assets/javascript/guides-app.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,28 +185,27 @@ const app = createApp({
185185
},
186186
async resetAndSearch() {
187187
this.resetAndMarkLoading()
188-
await this._searchBatch(this.initialTimeout)
188+
await this._searchBatch(this.loading, this.initialTimeout)
189189
},
190190
async searchMore() {
191191
if (this.loading) {
192192
return // Already searching
193193
}
194194
this.loading = new AbortController();
195195
this.search.page = this.search.page + 1
196-
await this._searchBatch(this.moreTimeout)
196+
await this._searchBatch(this.loading, this.moreTimeout)
197197
},
198198
_resetResults() {
199199
this.search.page = 0
200200
this.search.result.hits = []
201201
this.search.result.hasMoreHits = false
202202
},
203-
async _searchBatch(timeout) {
204-
if (!this.hasInput) {
205-
// No input => no search
206-
return
207-
}
208-
const controller = this.loading
203+
async _searchBatch(controller, timeout) {
209204
try {
205+
if (!this.hasInput) {
206+
// No input => no search
207+
return
208+
}
210209
if (this.hasInputWithTooFewChars) {
211210
throw 'Too few characters'
212211
}

0 commit comments

Comments
 (0)