Skip to content

Use supervisor-provided options for string app config fields#53077

Closed
kingpanther13 wants to merge 3 commits into
home-assistant:devfrom
kingpanther13:app-config-multi-string-options
Closed

Use supervisor-provided options for string app config fields#53077
kingpanther13 wants to merge 3 commits into
home-assistant:devfrom
kingpanther13:app-config-multi-string-options

Conversation

@kingpanther13

@kingpanther13 kingpanther13 commented Jul 9, 2026

Copy link
Copy Markdown

Proposed change

Multi-value string fields in app configuration always render with an empty
suggestion list, because the selector conversion hard-codes options: []. For
users this means fields like the Samba add-on's "Enabled shares" open an empty
dropdown and valid values must be typed from memory.

home-assistant/supervisor#7023 makes Supervisor include options on string
schema nodes whose match() regex is a simple alternation of literals. This
change passes those through to the select selector so valid values appear as
suggestions. custom_value stays enabled, so free-text entry is unaffected and
validation semantics do not change. Single-value string fields deliberately
keep their text selector even when options are present: the single-value
custom_value picker cannot store an empty string (clearing emits undefined,
which drops the key on save), so converting them would silently change
stored-value semantics. The schema-to-selector mapping for string fields is
extracted into a small util module with unit tests covering each outcome.

This PR functionally depends on home-assistant/supervisor#7023: today's
Supervisor never includes options on string schema nodes, so without that PR
this change is a safe no-op (entry.options is undefined and behavior is
byte-identical to today). Either merge order is safe, but there is no
user-visible effect until the Supervisor counterpart lands.

Screenshots

To be added: before (the current empty suggestion list on the Samba add-on's
"Enabled shares" field) and after (requires running this branch against a
Supervisor that includes home-assistant/supervisor#7023).

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

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • I have followed the perfect PR recommendations
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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

To help with the load of incoming pull requests:

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hi @kingpanther13

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

kingpanther13 and others added 2 commits July 10, 2026 15:01
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Supervisor emits options on both multi- and single-value match nodes;
consume them for singles too instead of silently dropping them.
Password-masked and format-typed fields keep their text selector.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kingpanther13
kingpanther13 force-pushed the app-config-multi-string-options branch from e0dc633 to 9a408cc Compare July 10, 2026 15:02
@kingpanther13 kingpanther13 changed the title Use supervisor-provided options for multi-value string app config fields Use supervisor-provided options for string app config fields Jul 10, 2026
Keep single-value fields on the text selector: the single-value
custom_value picker cannot store an empty string (clearing emits
undefined and the key is dropped on save), which would silently change
stored-value semantics.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the Tests: Unit Related to Vitest unit tests label Jul 10, 2026
@kingpanther13
kingpanther13 marked this pull request as ready for review July 10, 2026 15:41

@MindFreeze MindFreeze left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM but lets see what happens with the supervisor PR

@kingpanther13

Copy link
Copy Markdown
Author

Closing per the outcome in home-assistant/supervisor#7023: the fix moves into the Samba add-on itself. Step 1 (home-assistant/addons#4717) normalizes stored enabled_shares values to lower case; step 2 (home-assistant/addons#4718) switches the schema to list(), after which the existing select rendering shows the options and #51510 is resolved with no frontend change needed.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Addon config multi-select chip inputs show an empty suggestion list

2 participants