Changes to the valueText should also rescale ha-gauge text #23536
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.
Proposed change
When clicking through my energy dashboard, I sometimes noticed that the grid neutrality gauge didn't render correctly:
This happens, because
ha-gauge::_rescale_svg()
is only being called on a value or label update:frontend/src/components/ha-gauge.ts
Lines 60 to 73 in f724d8e
This works for almost all cases, however with the
hui-energy-grid-neutrality-gauge-card
, it breaks, becausevalue
andvalueText
are independent from each other.This bug only occurs, when there are multiple days with the same grid neutrality ratio but kWh usage differing by digit count.
Otherwise, the change of the ratio also triggers the
_rescale_svg()
According to the github code search, the grid neutrality gauge card is currently the only gauge where that can happen:
https://github.com/search?q=repo%3Ahome-assistant%2Ffrontend%20.valueText&type=code
These two factors are probably why it hasn't been discovered so far.
Type of change
Example configuration
Default energy dashboard
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: