rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.25k stars 175 forks source link

FilterGroupedItems with loadOptions groupHeaders duplication #494

Closed domialbrecht closed 1 year ago

domialbrecht commented 1 year ago

If loadOptions is used together with groupBy, and the list has already loaded once but no active filterText, filterGroupedItems is executed twice. This leaves unassigned groupHeader at the top of the list.

As far as I can tell this is from here: https://github.com/rob-balfre/svelte-select/blob/2c0cf04a8aec6f320620317c87fcc25b644a221c/src/lib/filter.js#L15

with filterText.length === 0 filterGroupedItems is still executed at the bottom https://github.com/rob-balfre/svelte-select/blob/2c0cf04a8aec6f320620317c87fcc25b644a221c/src/lib/filter.js#L36

REPL: https://svelte.dev/repl/d9280f63ae89431ca67e66137fc67be4?version=3.52.0

rob-balfre commented 1 year ago

@Sirfilior nice, thanks. Will fix up

rob-balfre commented 1 year ago

Fixed in 5.0.0-beta.40