-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle weather forecast callback delay #586 #623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution. Can you please address the comments on the code and also add some tests to cover this adjusted functionality?
handle if HA not supports subscription
Please check, I am ready with the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The pending calculation looks better now, but I think we still need to adjust how we use this pending
variable.
@@ -329,6 +331,7 @@ export class HourlyWeatherCard extends LitElement { | |||
} | |||
|
|||
if (!forecastNotAvailable && numSegments > (forecast.length - offset)) { | |||
if (pending) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about hiding this error in cases where the user has actually tried to configure the card to show more segments than the entity has available. I'm wondering if we should just make forecastNotAvailable
be true if the forecast is pending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is covered. Am I missing something?
When loading from the attribute (and subscription is available, yet not loaded) the error will be pending and will not be displayed.
Later on when the subscription returns and still number of segments are less than configured pending will be false, thus error is shown.
I have added pending temporary state - until the callback is not returned - to skip rendering any error messages in this state #586.
Please comment / modify if you see any better approach to circumvent the problem (e.g. delayed rendering).