Skip to content

Commit aa94c02

Browse files
committed
fix: Fix clearing unified search when modal is closed
The unified search modal was intended to be cleared when closed. However, "UnifiedSearchModal" did not emit "update:query" when its internal query value ("searchQuery") changed, so "UnifiedSearch.query" was kept as an empty string. When the modal was closed "update:query" was emitted with an empty string, which should have cleared "UnifiedSearch.query" and that, in turn, should have cleared the modal. However as "UnifiedSearch.query" was already an empty string the watcher that updates "UnifiedSearchModal.searchQuery" from "UnifiedSearch.query" was not triggered and the modal was not cleared. As "UnifiedSearch.query" is now updated with the value of "UnifiedSearchModal.searchQuery" the latter can not be trimmed when updated from the former, as that would in turn also trim "UnifiedSearchModal.searchQuery" and prevent to search for anything with spaces at the beginning or end (even if those trailing spaces are just temporary while writing something like "searched value"). Signed-off-by: Daniel Calviño Sánchez <[email protected]>
1 parent 88f3ee0 commit aa94c02

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

core/src/components/UnifiedSearch/UnifiedSearchModal.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,13 @@ export default defineComponent({
329329
query: {
330330
immediate: true,
331331
handler() {
332-
this.searchQuery = this.query.trim()
332+
this.searchQuery = this.query
333+
},
334+
},
335+
336+
searchQuery: {
337+
handler() {
338+
this.$emit('update:query', this.searchQuery)
333339
},
334340
},
335341
},

0 commit comments

Comments
 (0)