Reactive `selected` prop
See original GitHub issueI’m surprised to read in the docs that the selected prop is static (“[…] or passed as prop to set pre-selected options that will already be populated when the component mounts before any user interaction”).
In my case, the selected options depend on the external context, the URL params, and when I go back/forward the MultiSelect has to update in consequence.
This worked as I expect with version 6.1.0 but since version 7.1.0, the selected prop has become static (it does not take new values into account).
Is this intended behavior?
As a workaround, I did use:
{#key selected}
<MultiSelect {options} {selected} />
{/key}
Here is a quick-made REPL to demonstrate this: https://svelte.dev/repl/153f9049a9b849aa9fcc95117061a867?version=3.52.0
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
WebReflection/reactive-props: An all-in-one ... - GitHub
This module exports a default helper function that can create utilities to define reactive properties / states for data or DOM elements. For...
Read more >Reactive properties - Lit.dev
Lit manages your reactive properties and their corresponding attributes. ... For example, a menu component might have a public selected property that can...
Read more >SelectedFilters - Reactive Manual - Appbaseio Open Source
Most ReactiveSearch filter components have a prop showFilter (defaults to true ) which can be used to control whether the component's selected state...
Read more >Reactive default prop value - Stack Overflow
It's not a good idea to provide a default value base on a variable directly in props, the default in props is considered...
Read more >Props/Default Props - SolidJS · Reactive Javascript Library
Props objects are readonly and have reactive properties which are wrapped in Object getters. This allows them to have a consistent form regardless...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Released in v8.0.0. I confirmed that installing
in your REPL fixes the issue.
Yeah, I was just rereading your two-way binding recipe. Very cool that it works but it would require two new dependencies. I might just go with a wrapper component that dispatches events for testing whenever the two-way bound variable changes.