Skip to content

Only clear the forecast when the data source changes#707

Open
bjorkert wants to merge 1 commit into
devfrom
fix/forecast-clear-on-device-switch
Open

Only clear the forecast when the data source changes#707
bjorkert wants to merge 1 commit into
devfrom
fix/forecast-clear-on-device-switch

Conversation

@bjorkert

Copy link
Copy Markdown
Member

The refresh handler cleared the Loop and Trio forecasts on every refresh, including every websocket disconnect. On Loop that made the forecast vanish and only reappear on the next loop cycle, so on some instances it looked like it never came back.

The clearing now only happens when the active system actually changes. When a device status flips between Loop and Trio the previous system's forecast is dropped, and when Nightscout is turned off so there is no device status source, such as Dexcom only, both forecasts are cleared. Normal refreshes and websocket reconnects no longer touch the forecast.

The refresh handler used to wipe the Loop and Trio forecasts on every refresh, including every websocket disconnect, which made the Loop forecast disappear and only come back on the next loop cycle. Move the clearing so it only happens when the active system actually changes: when a device status flips between Loop and Trio, and when Nightscout is turned off so there is no device status source at all, such as Dexcom only.

@codebymini codebymini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Approve by code review and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants