The slots need to be updated to correctly render the previous and currently selected items.

Add this code above the selected property accessor:

The @query decorator provides convenient access to the slot elements. This will be used to see their currently assignedElements.

querySelector provides convenient access to the slot elements. This will be used to see their currently assignedElements.

Find the updateSlots method and change it as follows:

The updateSlots method removes any currently assigned elements and then slots in the items for the previous and selected values.