Skip to content
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

Sync selected icon with selected value in new select component #17573

Merged
merged 4 commits into from
Aug 16, 2023

Conversation

piitaya
Copy link
Member

@piitaya piitaya commented Aug 14, 2023

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@piitaya piitaya marked this pull request as ready for review August 14, 2023 13:27
@bramkragten
Copy link
Member

Not sure I understand what the difference is with the old code?

@piitaya
Copy link
Member Author

piitaya commented Aug 16, 2023

Not sure I understand what the difference is with the old code?

The old code set the icon using entity state value while now it's using the value of the select (this value can be changed using the property or when choosing select option).

This caused issue like this :
CleanShot_2023-08-14_at_14 29 42

@bramkragten
Copy link
Member

So it is like an optimistic update, but with the first state update it will be overridden right? Should we also handle it failing to update in time?

@piitaya
Copy link
Member Author

piitaya commented Aug 16, 2023

Yes, the select behavior isn't changed. It was always optimistic. This PR only sync between the label and the icon.
In the gif above, the preset is set to "night" but the icon stay to "home".

I need to check if it's not possible to get the icon from the selected ha-list-item instead of recomputing it.

@piitaya
Copy link
Member Author

piitaya commented Aug 16, 2023

I updated the code to get the icon from the selected item 🙂

@bramkragten bramkragten merged commit bd52643 into dev Aug 16, 2023
9 checks passed
@bramkragten bramkragten deleted the fix_new_select_icon branch August 16, 2023 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants