Skip to content

Commit

Permalink
[entities] Clear selection after search changes
Browse files Browse the repository at this point in the history
  • Loading branch information
frankrousseau committed Sep 24, 2024
1 parent b1395f7 commit 6d8a0ad
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
10 changes: 9 additions & 1 deletion src/components/mixins/entities.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mapGetters } from 'vuex'
import { mapGetters, mapActions } from 'vuex'

import func from '@/lib/func'
import preferences from '@/lib/preferences'
Expand Down Expand Up @@ -70,6 +70,8 @@ export const entitiesMixin = {
},

methods: {
...mapActions(['clearSelectedTasks']),

showImportModal() {
this.modals.isImportDisplayed = true
},
Expand Down Expand Up @@ -268,6 +270,7 @@ export const entitiesMixin = {
this.isSearchActive = false
const searchQuery = this.searchField.getValue() || ''
this.applySearch(searchQuery)
this.clearSelection()
},

onChangeSortClicked(sortInfo) {
Expand All @@ -284,6 +287,11 @@ export const entitiesMixin = {

onKeepTaskPanelOpenChanged(keepOpen) {
this.keepTaskPanelOpen = keepOpen
},

clearSelection() {
this[`clearSelected${this.entityTypeName}s`]()
this.clearSelectedTasks()
}
},

Expand Down
12 changes: 5 additions & 7 deletions src/components/pages/Assets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,10 @@ export default {
if (
this.assetMap.size < 2 ||
this.assetValidationColumns.length === 0 ||
(
this.assetValidationColumns.length > 0 &&
(
!this.assetMap.get(this.assetMap.keys().next().value).validations ||
this.assetMap.get(this.assetMap.keys().next().value).validations.size === 0
)
)
(this.assetValidationColumns.length > 0 &&
(!this.assetMap.get(this.assetMap.keys().next().value).validations ||
this.assetMap.get(this.assetMap.keys().next().value).validations
.size === 0))
) {
setTimeout(() => {
this.loadAssets().then(() => {
Expand Down Expand Up @@ -850,6 +847,7 @@ export default {
this.setAssetSearch(searchQuery)
this.setSearchInUrl()
}
this.clearSelection()
},
saveSearchQuery(searchQuery) {
Expand Down
1 change: 1 addition & 0 deletions src/components/pages/Edits.vue
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ export default {
if (searchQuery.length === 0 && this.isLongEditList) {
this.applySearch('')
}
this.clearSelection()
},
saveScrollPosition(scrollPosition) {
Expand Down
14 changes: 10 additions & 4 deletions src/components/pages/Shots.vue
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,15 @@ export default {
}
this.$refs['shot-search-field']?.setValue(searchQuery)
const finalize = () => {
this.loadShots(() => {
this.$nextTick(() => {
this.onSearchChange()
this.$nextTick(() => {
// Needed to be sure the current production is set
this.loadShots(() => {
this.$nextTick(() => {
this.$refs['shot-list'].selectTaskFromQuery()
// Needed to be sure the shots are loaded
this.onSearchChange()
this.$nextTick(() => {
this.$refs['shot-list'].selectTaskFromQuery()
})
})
})
})
Expand Down Expand Up @@ -584,6 +588,7 @@ export default {
'createTasks',
'changeShotSort',
'clearSelectedShots',
'clearSelectedTasks',
'commentTaskWithPreview',
'deleteAllShotTasks',
'deleteShot',
Expand Down Expand Up @@ -940,6 +945,7 @@ export default {
if (searchQuery.length === 0 && this.isLongShotList) {
this.applySearch('')
}
this.clearSelection()
},
saveScrollPosition(scrollPosition) {
Expand Down

0 comments on commit 6d8a0ad

Please sign in to comment.