Hello @Ser Fed ,
By all means, the sample was intended to demonstrate a simple implementation of the widget, so it is not fully optimized for user experience. If the widget process or system restarts, your provider will lose track of the widget IDs and their states.
Handling state persistence would increase the complexity of the sample, which is likely why it was not included. However, I understand your point about the user experience.
If you want to manage state for the widget, you can consider implementing local storage or using application settings to save the state when the widget is closed and restore it when it is reopened.
If you want to improve the sample, you could consider reporting to the official GitHub sample repository: https://github.com/microsoft/WindowsAppSDK-Samples/issues.
While this is a non-Microsoft link, it is the official Github repository of Windows App SDK samples.