Fix adding widgets with invalid config via app to home screen #2218
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Found a small bug in the new option to add widgets to your home screen via the app: invalid configuration only causes an exception when trying to save the data. However, when adding them via the app, the app will try saving the data after asking the launcher to add a widget, resulting in an error after adding a widget to the home screen and the widget on the home screen will never be updated.
This PR adjusts that process to check the variable/input that would typically cause the exception before asking the launcher to add a widget. Validation in general could be better, but at least now adding widgets from the app will match the behavior of adding widgets from the home screen.
(To test: add the updated widget without setting any values.)
Screenshots
n/a
Link to pull request in Documentation repository
n/a
Any other notes