Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>
Signed-off-by: nextcloud-command <[email protected]>
  • Loading branch information
nfebe authored and nextcloud-command committed Nov 30, 2023
commit daafc733faf5517ed39ca4f68a18af6587e2ab88
5 changes: 4 additions & 1 deletion core/src/views/GlobalSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Magnify class="global-search__trigger" :size="22" />
</template>
</NcButton>
<GlobalSearchModal :is-visible="showGlobalSearch" :class="'global-search-modal'" />
<GlobalSearchModal :class="'global-search-modal'" :is-visible="showGlobalSearch" @update:isVisible="handleModalVisibilityChange" />
</div>
</template>

Expand Down Expand Up @@ -54,6 +54,9 @@ export default {
toggleGlobalSearch() {
this.showGlobalSearch = !this.showGlobalSearch
},
handleModalVisibilityChange(newVisibilityVal) {
this.showGlobalSearch = newVisibilityVal
},
},
}
</script>
Expand Down
10 changes: 8 additions & 2 deletions core/src/views/GlobalSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<NcModal id="global-search"
ref="globalSearchModal"
:name="t('core', 'Global search')"
:show.sync="isVisible"
:show.sync="internalIsVisible"
:clear-view-delay="0"
:title="t('Global search')"
@close="closeModal">
Expand Down Expand Up @@ -201,6 +201,7 @@ export default {
contacts: [],
debouncedFind: debounce(this.find, 300),
showDateRangeModal: false,
internalIsVisible: false,
}
},

Expand All @@ -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) => {
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions dist/core-global-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-global-search.js.map

Large diffs are not rendered by default.