From 6f3bf8d77c0f8fdaf68022e9144233ef59f59427 Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Tue, 28 Nov 2023 11:01:31 +0100 Subject: [PATCH] Handle close GlobalSearchModal gracefully The current close infrastructure modifies a prop which has no real effect aside bugs. In addition, calling the `NcModal.close()` as the primary way to close the search modal instead of using the states defined in `GlobalSearch` view causing re-open bugs (Modal cannot open, needs to click twice, and other weird stuff). Signed-off-by: fenn-cs --- core/src/views/GlobalSearch.vue | 5 ++++- core/src/views/GlobalSearchModal.vue | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/src/views/GlobalSearch.vue b/core/src/views/GlobalSearch.vue index 2bca15ec905b4..24547fd627089 100644 --- a/core/src/views/GlobalSearch.vue +++ b/core/src/views/GlobalSearch.vue @@ -26,7 +26,7 @@ - + @@ -54,6 +54,9 @@ export default { toggleGlobalSearch() { this.showGlobalSearch = !this.showGlobalSearch }, + handleModalVisibilityChange(newVisibilityVal) { + this.showGlobalSearch = newVisibilityVal + }, }, } diff --git a/core/src/views/GlobalSearchModal.vue b/core/src/views/GlobalSearchModal.vue index 9058776780f4a..d598b496b1d0e 100644 --- a/core/src/views/GlobalSearchModal.vue +++ b/core/src/views/GlobalSearchModal.vue @@ -2,7 +2,7 @@ @@ -201,6 +201,7 @@ export default { contacts: [], debouncedFind: debounce(this.find, 300), showDateRangeModal: false, + internalIsVisible: false, } }, @@ -225,12 +226,17 @@ export default { }, watch: { isVisible(value) { + this.internalIsVisible = value + }, + internalIsVisible(value) { + this.$emit('update:isVisible', value) this.$nextTick(() => { if (value) { this.focusInput() } }) }, + }, mounted() { getProviders().then((providers) => { @@ -517,7 +523,7 @@ export default { this.$refs.searchInput.$el.children[0].children[0].focus() }, closeModal() { - this.$refs.globalSearchModal.close() + this.internalIsVisible = false this.searchQuery = '' }, supportFiltering() {