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
I want to wrap svelte-select in a custom component MySelect, where the value is just value, not the list of full selected objects. It should be a full 2-way binding, i.e. modifying the value outside of MySelect should work, but I can't figure out how without causing the error effect_update_depth_exceeded
// keep value in sync with selectionletselection=$state(value);$effect(()=>{value=selection?.map(i=>i.value)})// keep selection in sync with value (from external changes)// FIXME: causes effect loop$effect(()=>{selection=value;})// bind:value={selection}
I also tried using justValue, but it's the same result:
// keep value in sync with selectionletselection=$state(value);letjustValue=$state();$effect(()=>{value=justValue;})// keep selection in sync with value (from external changes)// FIXME: causes effect loop$effect(()=>{selection=value;})// bind:value={selection} bind:justValue
I've seen a few other issues on here asking for justValue to be read/write, which I think would also solve my problem.
Any other suggestions? Thanks for the help.
The text was updated successfully, but these errors were encountered:
I want to wrap
svelte-select
in a custom componentMySelect
, where the value is just value, not the list of full selected objects. It should be a full 2-way binding, i.e. modifying the value outside ofMySelect
should work, but I can't figure out how without causing the erroreffect_update_depth_exceeded
REPL: https://svelte.dev/playground/d6bf0339969e40a181352d3aaaee5f3a?version=5.19.10
I also tried using
justValue
, but it's the same result:I've seen a few other issues on here asking for
justValue
to be read/write, which I think would also solve my problem.Any other suggestions? Thanks for the help.
The text was updated successfully, but these errors were encountered: