-
-
Notifications
You must be signed in to change notification settings - Fork 15
Fix sync state dropdown rendering and add option labels #276
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
Fix sync state dropdown rendering and add option labels #276
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #276 +/- ##
========================================
- Coverage 3.36% 3.36% -0.01%
========================================
Files 55 55
Lines 10150 10174 +24
Branches 156 156
========================================
Hits 342 342
- Misses 9808 9832 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR fixes TypeScript type errors in the knx-sync-state-selector-row component by ensuring all values passed to ha-selector-select are strings, while maintaining backward compatibility with the backend API that expects boolean values.
Key changes:
- Convert boolean strategy values to string literals ("true"/"false") for frontend compatibility
- Add bidirectional conversion between string and boolean representations
- Update type annotations to reflect string-only internal handling
| mode: "dropdown", | ||
| options: this._options, | ||
| mode: "dropdown" as const, | ||
| options: this._options as readonly string[], |
Copilot
AI
Oct 23, 2025
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.
Type assertion required here suggests a type mismatch. Consider updating _options getter return type to readonly string[] instead of using an assertion at the call site, making the type system work for you rather than against you.
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.
Implemented. Changed to readonly string[] which removes the need for the type assertion.
|
Hi 👋! Thank you very much for your contribution! |
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
|
|
||
| // Validate strategy value before assignment | ||
| const validStrategies = ["true", "false", "init", "expire", "every"] as const; | ||
| if (validStrategies.includes(strategy as any)) { |
Copilot
AI
Oct 23, 2025
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.
Using as any defeats TypeScript's type safety. Use a type predicate or assertion function instead: if (validStrategies.includes(strategy as (typeof validStrategies)[number]))
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.
Very nice 👍 Thank you!
Fixes TypeScript type errors in
knx-sync-state-selector-rowcomponent.The issue:
ha-selector-selectexpects string values, but we were mixing booleans (true/false) with strings ("init","expire","every"), causing TypeScript errors.The fix:
"true"/"false")true/falseas booleans)Related to #157
before:


after: