Skip to content

Commit

Permalink
Removed offset handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenthoms committed Oct 26, 2023
1 parent 709fc20 commit 071d9ba
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions frontend/src/lib/components/Select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const Select = withDefaults<SelectProps>()(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];
Expand All @@ -70,7 +69,7 @@ export const Select = withDefaults<SelectProps>()(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);
Expand Down

0 comments on commit 071d9ba

Please sign in to comment.