1
0
mirror of https://github.com/flarum/core.git synced 2025-08-03 15:07:53 +02:00

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 dfab94ae8a
commit ef6040a0a8

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)));
} }
/** /**