Fix active search jumping to last item during loading

This commit is contained in:
Clark Winkelmann 2022-02-21 17:02:56 +01:00 committed by Daniël Klabbers
parent 2d18d37ba9
commit edd93dad77

View File

@ -325,9 +325,10 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
/** /**
* Get the position of the currently selected search result item. * Get the position of the currently selected search result item.
* Returns zero if not found.
*/ */
getCurrentNumericIndex(): number { getCurrentNumericIndex(): number {
return this.selectableItems().index(this.getItem(this.index)); return Math.max(0, this.selectableItems().index(this.getItem(this.index)));
} }
/** /**