Force reload from UserDefaults#2279
Conversation
SummaryThis fixes a display glitch: With an iOS 18 phone, there was a display glitch where changes to Algorithm Experiments (AE) settings were made but not consistently displayed:
This PR fixes this. Note there are similar display glitches to other screens but they are not addressed with this PR. TestTest phone: SE running iOS 18.2.1 Test changes to AE settingsTest phone started with GBPA on and IRC off. Tap on Predicted Glucose and the IRC component now visible Test more changes to AE settingsRepeat the test by enabling GPBA and disabling IRC and the settings are displayed correctly and have the expected effect. |
Purpose: this fix a display issue whereby changing an Algorithm Experiment then backing out from Algorithm experiments section and back in (without closing settings) results in the data being displayed as it initially appeared. This issue is mentioned in this comment (#2267 (comment)) - note that issue 2267 (which also has similar behavior in terms of a view not being updated despite the underlying data being saved) is however unrelated and thus this PR doesn't address it.
This is caused by the view being discarded from the render tree and then being restored as it was initialized.
This fix addresses this and cleans up the code as well by using AppStorage - the selection views themselves then only work with the Bindings and not directly with UserDefaults.