Skip to content

Commit

Permalink
Merge pull request #200 from Confidenceman02/issue/198
Browse files Browse the repository at this point in the history
Avoid creating redundant List with all menu items
  • Loading branch information
Confidenceman02 authored Jan 19, 2025
2 parents d2bf008 + 1141d87 commit 2e3c124
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Select.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2324,16 +2324,15 @@ viewVirtual (Config config) =
adjustedItem =
applyVirtualConfigMenuItem idx virtualConfig.height mi
in
Tuple.mapBoth ((::) adjustedItem) (Array.push adjustedItem) acc
Array.push adjustedItem acc
)
( [], Array.empty )
Array.empty
filteredMenuItems
|> sliceItems
|> Tuple.first
|> setVirtualMenuItems config.menuItems

sliceItems ( _, cache ) =
( Array.slice startIndex (stopIndex + 1) cache |> Array.toList, cache )
sliceItems cache =
Array.slice startIndex (stopIndex + 1) cache |> Array.toList

startIndexForOffset : Int
startIndexForOffset =
Expand Down

0 comments on commit 2e3c124

Please sign in to comment.