rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
450 stars 254 forks source link

[@rancher/components] ToggleSwitch refactor towards simplification #6760

Open rak-phillip opened 2 years ago

rak-phillip commented 2 years ago

ToggleSwitch was originally written in such a way that it maintains state locally. rancher/dashboard#6751 recently introduced behavior to make the state reactive as well as introducing unit tests. With the tests in place, we should have more certainty in further refactoring.

In refactoring this component, we should

a. Remove all internal state management from ToggleSwitch.vue b. Adhere to the principal of props down, events up c. Remove the watcher for value

Prime example: within Rancher Desktop, this would help with hiding diagnostic checks if they don't apply in certain environments.

gaktive commented 1 year ago

This would support the work done in rancher/dashboard#6760 so if we make that component simpler, the docs would then be easier to write.