Clear stored predBGs when clearing the OpenAPS forecast#724
Merged
Conversation
Switching from a Trio site to a Loop site left the old Trio forecast on the chart. The flip detection in updateDeviceStatusDisplay cleared the drawn lines and the cone, but the device observer fires right after and calls updateOpenAPSPredictionDisplay, which redrew the forecast from the stored predBGs. Those are only cleared when an openaps record without predBGs arrives, which never happens on a Loop site, so the stale lines stayed until the app was restarted. Clearing the stored predBGs together with the drawn data stops the forecast from coming back. The Loop to Trio direction was already working.
Collaborator
|
I tested the build on two phones, one looking at Loop URL and Trio URL, and Mac Catalyst (Loop URL). I use separate phones for different URLs so would not have seen this bug. |
marionbarker
approved these changes
Jul 25, 2026
marionbarker
left a comment
Collaborator
There was a problem hiding this comment.
approve by code review and test build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Switching from a Trio site to a Loop site left the old Trio forecast lines on the chart until the app was restarted. The switch itself is detected and clearOpenAPSPredictionGraph runs, but the device observer fires right after and calls updateOpenAPSPredictionDisplay, which drew the forecast again from the stored predBGs. Those are only cleared when an openaps record without predBGs arrives, which never happens on a Loop site. This clears the stored predBGs together with the drawn lines and cone, so there is nothing left to redraw from. The Loop to Trio direction already worked. Verified in the simulator against a live Trio and a live Loop site, switching in both directions.