From daafc733faf5517ed39ca4f68a18af6587e2ab88 Mon Sep 17 00:00:00 2001 From: fenn-cs Date: Tue, 28 Nov 2023 11:01:31 +0100 Subject: 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 Signed-off-by: nextcloud-command --- core/src/views/GlobalSearch.vue | 5 ++++- core/src/views/GlobalSearchModal.vue | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'core/src') diff --git a/core/src/views/GlobalSearch.vue b/core/src/views/GlobalSearch.vue index 2bca15ec905..24547fd6270 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 b8a302a15bf..cfed7543e0d 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) => { @@ -516,7 +522,7 @@ export default { this.$refs.searchInput.$el.children[0].children[0].focus() }, closeModal() { - this.$refs.globalSearchModal.close() + this.internalIsVisible = false this.searchQuery = '' }, supportFiltering() { -- cgit v1.2.3