Restore Loop forecast after a refresh clears it#706
Open
bjorkert wants to merge 1 commit into
Open
Conversation
refresh() clears predictionData and redraws an empty forecast, but the Loop forecast is only rebuilt when a newer loop cycle arrives (previousLastLoopTime < lastLoopTime). Since the current cycle has already been seen at that point, the forecast stays blank until the pump clock advances. Also rebuild when predictionData is empty so the next device-status poll restores the forecast regardless of cycle timing.
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.
On Loop data sources, the glucose forecast is drawn on first load but disappears after a refresh and does not reappear until the next loop cycle.
refresh()clearspredictionDataand redraws an empty forecast. It runs on pull-to-refresh, on data-source reconfiguration, and on every WebSocket disconnect (which posts therefreshnotification). The Loop forecast is only rebuilt inDeviceStatusLoop, and only when a newer loop cycle arrives (previousLastLoopTime < lastLoopTime). Because the current cycle has already been seen at that point, the forecast stays blank until the pump clock advances — up to five minutes, and longer when the WebSocket disconnects repeatedly.Rebuild the forecast when
predictionDatais empty as well, so the next device-status poll restores it regardless of cycle timing. Same-cycle polls that already have forecast points continue to skip the rebuild. This mirrors the OpenAPS/Trio path, which already repopulates its prediction unconditionally and is unaffected.