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

Search - Unable to rehydrate previous selections #341

Open
TSenter opened this issue Jan 21, 2025 · 0 comments
Open

Search - Unable to rehydrate previous selections #341

TSenter opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@TSenter
Copy link
Contributor

TSenter commented Jan 21, 2025

Since the search component works without having the valid options initially loaded (since there can be thousands of applicable options), there is no way to fully render a previously selected option. While we can display the selected value in the input, that value may not match what the app wants to display since the list options use label, while the rehydrated value uses value.

get displayValue() {
if (!this.value) {
return this.searchString;
}
if (this.args.serializationPath === null) {
return get(this.value, this.args.displayPath ?? 'label') as string;
}
if (this.selectedOption) {
return this.selectedOption.label;
}
return '';
}

Currently, the problem lies elsewhere: the Search component always uses the displayString as the text to render in the input. When the component is loaded with a value, this value never reflects the selected value.

@binding={{bind this.self "searchString"}}

@TSenter TSenter added the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant