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

svelte-select Displays Undefined for Numeric Values #662

Open georgeemr opened 5 months ago

georgeemr commented 5 months ago

Problem: The svelte-select component is not displaying the selected item correctly when the items prop is an array of objects with numeric values. However, it works as expected with string values. When using numeric values, the selected item shows "undefined" instead of the correct label.

Expected Behavior: Irrespective of the data type of the value field in the items array (string or numeric), the svelte-select component should display the label of the selected item correctly.

Steps to Reproduce: Use the svelte-select component with an items array having numeric values for the value field. Two ways to reproduce it: • When the item is set on the OnMount (for example if i'm loading a model from a API) notice that the component displays "undefined" for the selected item. • If you search the value, then select it, it shows undefined too. If you don't search, just select it from the list, it works.

Sample Code: https://svelte.dev/repl/f203e41b174441a1a217216ce01b0099?version=4.2.8

georgeemr commented 5 months ago

I think this pull resolve this problem: https://github.com/rob-balfre/svelte-select/pull/612

But anyone hasn't merged. Does this project is still active?