Fixed scrolling displaying duplicate results

This commit is contained in:
Geomitron
2020-05-30 12:44:30 -04:00
parent e66a34d45d
commit 5224534d17
2 changed files with 4 additions and 4 deletions

View File

@@ -69,7 +69,7 @@ export class SearchService {
async updateScroll() { async updateScroll() {
if (!this.awaitingResults && !this._allResultsVisible) { if (!this.awaitingResults && !this._allResultsVisible) {
this.awaitingResults = true this.awaitingResults = true
this.currentQuery.offset += 20 this.currentQuery.offset += 50
this.results.push(...this.trimLastChart(await this.electronService.invoke('song-search', this.currentQuery))) this.results.push(...this.trimLastChart(await this.electronService.invoke('song-search', this.currentQuery)))
this.awaitingResults = false this.awaitingResults = false
@@ -78,8 +78,8 @@ export class SearchService {
} }
trimLastChart(results: SongResult[]) { trimLastChart(results: SongResult[]) {
if (results.length > 20) { if (results.length > 50) {
results.splice(20, 1) results.splice(50, 1)
this._allResultsVisible = false this._allResultsVisible = false
} else { } else {
this._allResultsVisible = true this._allResultsVisible = true

View File

@@ -9,7 +9,7 @@ class SearchHandler implements IPCInvokeHandler<'song-search'> {
event: 'song-search' = 'song-search' event: 'song-search' = 'song-search'
/** /**
* @returns the top 20 songs that match `search`. * @returns the top 50 songs that match `search`.
*/ */
async handler(search: SongSearch) { async handler(search: SongSearch) {
return new Promise<SongResult[]>((resolve, reject) => { return new Promise<SongResult[]>((resolve, reject) => {