Currently, removing the widget from the panel leaves the panel in a broken state.
Customization is not removed, and this is not what users expect to happen
Panel is left in a broken state because it tries to apply things on widget count change, but the widget can no longer reach all other widgets
Possible solution
[ ] Find a way to detect when the widget has been removed but not confirmed yet and either block it or remove the customization right away
[ ] If hooking into widget removed but not confirmed is not possible trigger the removal when it is confirmed (possibly with Component.onDestruction signal)
Adding it back (cancelling the deletion) is already handled by panel exiting edit mode signal
Possibly required changes
Store all the references to foreground (text, icons...) elements instead of always looping through the panel to find them
Lowered to enhancement as the button to restore the default appearance actually works. Also because I'm not sure if restoring on remove is worth the effort or possible at all.
Currently, removing the widget from the panel leaves the panel in a broken state.
Possible solution
Component.onDestruction
signal)Possibly required changes Store all the references to foreground (text, icons...) elements instead of always looping through the panel to find them