You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use the search-component with an extern search value. In our example the search term will come as url-parameter from another component. In our case the first result of the search, should be choosen and trigger the onSelect function as usual.
Discussion
We can implement the feature but there seem to be multple options for the general use case, that should be discussed:
If there is just a single result:
Just trigger onSelect for this
If there are multple results:
Just take the first result of the search and trigger onSelect
Do nothing
Show a warning
Show a warning, but still use the first result
Modify SearchSelectEvent and return an Array of SearchResult with onSelect
If there is no result:
Do nothing
Show a warning
Modify SearchSelectEvent and let SearchResult be null or an empty Array
And maybe there is an other case, that i didn't think of :)
I think modifying SearchSelectEvent to an SearchResult-Array would give the developer the most freedom, but would also be a breaking change.
Here are my thoughts:
I am not sure if we should trigger onSelect automatically since generally we don't know what the expected behavior might be.
Instead I would introduce onSearchCompleted which provides the search results and the developer can use it as it is desired.
Alternatively we could even introduce onSearchStateChanged => (searchState: FullSearchState) => void;.
Then the developer could react on every change. That would basically supersede the existing onSelect (and onInputChanged that we might introduce). But I think this would
be a big change to the current API
trigger many events (e.g. every time the user types in a single character) that might be hard to handle for the developer.
Issue description
Issue description
I would like to use the search-component with an extern search value. In our example the search term will come as url-parameter from another component. In our case the first result of the search, should be choosen and trigger the
onSelect
function as usual.Discussion
We can implement the feature but there seem to be multple options for the general use case, that should be discussed:
onSelect
for thisonSelect
SearchSelectEvent
and return an Array ofSearchResult
withonSelect
SearchSelectEvent
and letSearchResult
benull
or an empty ArrayAnd maybe there is an other case, that i didn't think of :)
I think modifying
SearchSelectEvent
to anSearchResult
-Array would give the developer the most freedom, but would also be a breaking change.Validations
The text was updated successfully, but these errors were encountered: