svelte-select icon indicating copy to clipboard operation
svelte-select copied to clipboard

handleClear and handleMultiClear behave differently. handleClear runs the clear event with the Select's value before the clear. HandleMultiClear the value after the clear.

Open mattdam opened this issue 1 year ago • 3 comments

The Clear event fires before the item has been cleared. There is no event that fires after the item has been cleared. It seems like the change event should fire after the clear has been completed as the value of the dropdown has changed.

My use case would be to create cascading dropdowns and I would like to update the second dropdown anytime there is a change in the value of the first dropdown.

There is a current workaround. I can clear the value of the first dropdown in my handling of the Clear event or I can just not depend the value of the dropdown in the Clear event. In the case of single select, the value will end up being undefined after the clear occurs, so i can just treat it as undefined when populating the second dropdown.

Ideally the Change event would execute every time the value changes, not just when a value is selected. That way I can just handle changes in one way, instead of having to handle the Change event as expected and the Clear event in a different less than ideal way.

mattdam avatar Jun 02 '23 04:06 mattdam