You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Setting the value of a Select component at the same time the Options are updated causes the Select component's value to change once, and then change again to undefined
I something simalar but when change the options and value i see the second value set in console log corectly but the selector visually does not update (if i click on the selector i can see the correct value is selected then, but whern i click away it dose not show in the ui).. and when i change back to native select and options it works correctly.
Any ideas on workarounds?
igrep
pushed a commit
to igrep/svelte-material-ui
that referenced
this issue
May 14, 2024
Approach
====
Without this change, the `Select` component doesn't know the `Options`
(items in the internal `List` component) after `onMount`. So it can't tell
which `Option`s are added/removed.
To fix the root cause, I created a new events to `List`: `SMUIList:mountItem`
and `SMUIList:unmountItem`, which tells the parent when some of its children
are added or removed. Then, I implemented an event handler of `Select` for the
new events to update the internal list and call `layoutOptions`. `layoutOptions`
should always be called whenever the options are updated
Another Option
====
The change might be simpler adding `bind:accessor={list}` to the `List`. But I
didn't choose it because `List` seems to want to hide its `accessor` as the
implementation details. I'll rewrite if you prefer.
Ref: hperrin#538.
Ref: https://discord.com/channels/833139170703704115/1228040959670091787
Describe the bug
Setting the value of a Select component at the same time the Options are updated causes the Select component's value to change once, and then change again to undefined
To Reproduce
(See REPL here: https://svelte.dev/repl/7e74d75b52a84e09b4ad7aff4342ddf3?version=3.53.1)
Expected behavior
Expect the value to get set and keep it. The expected behavior can be seen in the same REPL using the basic select element
Screenshots
(See REPL here: https://svelte.dev/repl/7e74d75b52a84e09b4ad7aff4342ddf3?version=3.53.1)
The text was updated successfully, but these errors were encountered: