File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ export default defineComponent({
172
172
this . $emit ( 'input' , val )
173
173
} ,
174
174
175
- handleClearTextClick : function ( { programmaticallyTriggered = false } ) {
175
+ handleClearTextClick : function ( ) {
176
176
// No action if no input text
177
177
if ( ! this . inputDataPresent ) { return }
178
178
@@ -183,9 +183,7 @@ export default defineComponent({
183
183
this . $refs . input . value = ''
184
184
185
185
// Focus on input element after text is clear for better UX
186
- if ( ! programmaticallyTriggered ) {
187
- this . $refs . input . focus ( )
188
- }
186
+ this . $refs . input . focus ( )
189
187
190
188
this . $emit ( 'clear' )
191
189
} ,
@@ -244,10 +242,12 @@ export default defineComponent({
244
242
this . searchState . showOptions = false
245
243
if ( this . visibleDataList [ index ] . route ) {
246
244
this . inputData = `ft:${ this . visibleDataList [ index ] . route } `
245
+ this . $emit ( 'input' , this . inputData )
246
+ this . inputData = this . $refs . input . value = this . visibleDataList [ index ] . name
247
247
} else {
248
248
this . inputData = this . visibleDataList [ index ]
249
+ this . $emit ( 'input' , this . inputData )
249
250
}
250
- this . $emit ( 'input' , this . inputData )
251
251
this . handleClick ( )
252
252
} ,
253
253
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ export default defineComponent({
127
127
if ( ! this . enableSearchSuggestions ) {
128
128
return
129
129
}
130
- return this . lastSuggestionQuery === '' ? this . $store . getters . getLatestUniqueSearchHistoryEntries : this . searchSuggestionsDataList
130
+ return this . lastSuggestionQuery === '' ? this . $store . getters . getLatestUniqueSearchHistoryEntries ( this . $router . currentRoute . fullPath ) : this . searchSuggestionsDataList
131
131
} ,
132
132
} ,
133
133
watch : {
@@ -177,7 +177,6 @@ export default defineComponent({
177
177
clearLocalSearchSuggestionsSession ( )
178
178
179
179
if ( queryText . startsWith ( 'ft:' ) ) {
180
- this . $refs . searchInput . handleClearTextClick ( { programmaticallyTriggered : true } )
181
180
const adjustedQuery = queryText . substring ( 3 )
182
181
openInternalPath ( {
183
182
path : adjustedQuery ,
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ const getters = {
12
12
return state . searchHistoryEntries
13
13
} ,
14
14
15
- getLatestUniqueSearchHistoryEntries : ( state ) => {
15
+ getLatestUniqueSearchHistoryEntries : ( state ) => ( routeToExclude ) => {
16
16
const nameSet = new Set ( )
17
17
return state . searchHistoryEntries . filter ( ( entry ) => {
18
- if ( nameSet . has ( entry . name ) ) {
18
+ if ( nameSet . has ( entry . name ) || routeToExclude === entry . route ) {
19
19
return false
20
20
}
21
21
You can’t perform that action at this time.
0 commit comments