From 071d9badf0a33cdad89d905a1d255c099b94fe28 Mon Sep 17 00:00:00 2001 From: Ruben Thoms Date: Thu, 26 Oct 2023 13:32:08 +0200 Subject: [PATCH] Removed offset handling --- frontend/src/lib/components/Select/select.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/lib/components/Select/select.tsx b/frontend/src/lib/components/Select/select.tsx index 0a5ccadf8..b641ef1b1 100644 --- a/frontend/src/lib/components/Select/select.tsx +++ b/frontend/src/lib/components/Select/select.tsx @@ -60,7 +60,6 @@ export const Select = withDefaults()(defaultProps, (props) => { if (!isEqual(filteredOptions, prevFilteredOptions)) { let newCurrentIndex = 0; let newStartIndex = 0; - const indexOffset = currentIndex - startIndex; let oldCurrentValue = prevFilteredOptions[currentIndex]?.value; if (props.value?.length >= 1) { oldCurrentValue = props.value[0]; @@ -70,7 +69,7 @@ export const Select = withDefaults()(defaultProps, (props) => { const newIndex = filteredOptions.findIndex((option) => option.value === oldCurrentValue); if (newIndex !== -1) { newCurrentIndex = newIndex; - newStartIndex = Math.max(0, newIndex - indexOffset); + newStartIndex = newIndex; } } setCurrentIndex(newCurrentIndex);