Skip to content

Comments

fix: recalculate item width when number of forecast changes#28

Merged
troinine merged 5 commits intomainfrom
bugfix/forecast-not-rendered-on-delayed-weather-data
Dec 19, 2025
Merged

fix: recalculate item width when number of forecast changes#28
troinine merged 5 commits intomainfrom
bugfix/forecast-not-rendered-on-delayed-weather-data

Conversation

@troinine
Copy link
Owner

This PR fixes an issue where forecast data was not rendered on delayed forecast data. If the forecast is initially empty and is received later, the card didn't render forecast data at all.

@troinine troinine added the fix Fix or improvement label Dec 19, 2025
@troinine troinine requested a review from Copilot December 19, 2025 15:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an issue where forecast data was not rendered when it arrived delayed (initially empty but received later). The fix adds logic to detect when the number of forecast items changes and triggers a layout recalculation to properly display the forecast data.

  • Tracks previous forecast lengths before updating forecast data
  • Recalculates layout when the number of forecast items changes
  • Adds test coverage for the layout recalculation behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/weather-forecast-card.ts Adds logic to detect forecast length changes and trigger layout recalculation
test/weather-forecast-card.test.ts Adds test to verify layout recalculation when forecast item count changes
test/mocks/hass.ts Updates mock updateForecasts method to accept forecast type parameter and trigger subscriptions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

troinine and others added 3 commits December 19, 2025 18:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@troinine troinine merged commit 945c566 into main Dec 19, 2025
9 checks passed
@troinine troinine deleted the bugfix/forecast-not-rendered-on-delayed-weather-data branch December 19, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fix or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant