Skip to content

Commit

Permalink
Fix array search compatibility in RangeAutocompleteFormField (#8021)
Browse files Browse the repository at this point in the history
Co-authored-by: Khavin Shankar <[email protected]>
  • Loading branch information
bodhish and khavinshankar authored Jun 14, 2024
1 parent 369a38e commit a7eec27
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default function RangeAutocompleteFormField(props: Props) {
const sortedThresholds = props.thresholds?.sort(compareBy("value")) || [];

const getThreshold = (value: number) => {
const threshold = sortedThresholds.findLast(
const reversedThresholds = [...sortedThresholds].reverse();
const threshold = reversedThresholds.find(
(threshold) => value >= threshold.value,
);
return threshold;
Expand Down

0 comments on commit a7eec27

Please sign in to comment.