File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,8 @@ interface MatchProps {
49
49
result : Result ;
50
50
}
51
51
52
- function highlightCallback ( highlighted : string , _ind : number ) : ReactElement {
53
- return < b > { highlighted } </ b > ;
52
+ function highlightCallback ( highlighted : string , ind : number ) : ReactElement {
53
+ return < b key = { ind } > { highlighted } </ b > ;
54
54
}
55
55
56
56
function Match ( { result } : MatchProps ) : ReactElement {
@@ -99,14 +99,15 @@ export const Search = ({ descriptors }: SearchParams) => {
99
99
onChange = { ( event ) => {
100
100
setSearchTerm ( event . target . value ) ;
101
101
} }
102
+ value = { searchTerm }
102
103
/>
103
104
{ searchTerm && results && (
104
105
< SearchResultContainer >
105
106
{ results . total === 0 && "No results found" }
106
107
{ results . total > 0 &&
107
108
results . map ( ( result : Result , ind : number ) => (
108
109
< SearchResultItem key = { `${ result . obj . name } _${ ind } ` } >
109
- < ItemLink to = { `${ result . obj . url } ` } >
110
+ < ItemLink to = { `${ result . obj . url } ` } onClick = { ( event ) => setSearchTerm ( "" ) } >
110
111
< Match result = { result } />
111
112
</ ItemLink >
112
113
</ SearchResultItem >
You can’t perform that action at this time.
0 commit comments