svelteuidev / svelteui

SvelteUI Monorepo
https://svelteui.dev
MIT License
1.27k stars 63 forks source link

Make Chip component 'checked' prop controlled #402

Open BeeMargarida opened 1 year ago

BeeMargarida commented 1 year ago

It should be possible to make the checked prop of Chip component (and other similar components) controlled. This means that it keeps an internal state or updates based on changes in the external state, that is passed down by changing the prop value.

khalibloo commented 1 year ago

Looks like this is already done? image

BeeMargarida commented 1 year ago

It's not, this happens when we change the state inside (like toggling the checked) and then we try to change outside. There's an example of the problematic behaviour here: https://discord.com/channels/954790377754337280/1109187255903453245/1109442589138100335

bmw2621 commented 1 year ago

I dont believe this is an issue with the component, as the same logic applied to a checkbox yields the same result. We need to research createEventForwarder and see why the checked closure isn't passing through.

BeeMargarida commented 1 year ago

Yes, it yields the same issue, but we want it to be possible to override the "state" when changing the prop, even if we changed it internally.