From a466766c5cb9eab4b7aa63d0e3a7aad20ff91bf8 Mon Sep 17 00:00:00 2001 From: Pratik Date: Tue, 8 Apr 2025 18:22:44 +0530 Subject: [PATCH] refactor: remove unnecessary watchers --- frontend/src/components/ListViews/CallLogsListView.vue | 9 +-------- frontend/src/components/ListViews/ContactsListView.vue | 10 +--------- frontend/src/components/ListViews/DealsListView.vue | 10 +--------- .../components/ListViews/EmailTemplatesListView.vue | 10 +--------- frontend/src/components/ListViews/LeadsListView.vue | 10 +--------- .../src/components/ListViews/OrganizationsListView.vue | 10 +--------- frontend/src/components/ListViews/TasksListView.vue | 10 +--------- frontend/src/pages/Leads.vue | 4 +++- 8 files changed, 10 insertions(+), 63 deletions(-) diff --git a/frontend/src/components/ListViews/CallLogsListView.vue b/frontend/src/components/ListViews/CallLogsListView.vue index 45e8d8b9..11c7e754 100644 --- a/frontend/src/components/ListViews/CallLogsListView.vue +++ b/frontend/src/components/ListViews/CallLogsListView.vue @@ -10,7 +10,7 @@ }" row-key="name" v-bind="$attrs" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( () => listBulkActionsRef.value?.customListActions, diff --git a/frontend/src/components/ListViews/ContactsListView.vue b/frontend/src/components/ListViews/ContactsListView.vue index 4d2b314b..99a205fe 100644 --- a/frontend/src/components/ListViews/ContactsListView.vue +++ b/frontend/src/components/ListViews/ContactsListView.vue @@ -14,7 +14,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) - -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/DealsListView.vue b/frontend/src/components/ListViews/DealsListView.vue index 6b90e400..8820a00d 100644 --- a/frontend/src/components/ListViews/DealsListView.vue +++ b/frontend/src/components/ListViews/DealsListView.vue @@ -14,7 +14,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) - -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/EmailTemplatesListView.vue b/frontend/src/components/ListViews/EmailTemplatesListView.vue index df8b1118..a2834ba2 100644 --- a/frontend/src/components/ListViews/EmailTemplatesListView.vue +++ b/frontend/src/components/ListViews/EmailTemplatesListView.vue @@ -9,7 +9,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) - -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/LeadsListView.vue b/frontend/src/components/ListViews/LeadsListView.vue index 09addab8..f09f12b6 100644 --- a/frontend/src/components/ListViews/LeadsListView.vue +++ b/frontend/src/components/ListViews/LeadsListView.vue @@ -14,7 +14,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) - -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/OrganizationsListView.vue b/frontend/src/components/ListViews/OrganizationsListView.vue index a8c27900..b99e628b 100644 --- a/frontend/src/components/ListViews/OrganizationsListView.vue +++ b/frontend/src/components/ListViews/OrganizationsListView.vue @@ -13,7 +13,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) - -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( diff --git a/frontend/src/components/ListViews/TasksListView.vue b/frontend/src/components/ListViews/TasksListView.vue index 18d239d9..0be065f1 100644 --- a/frontend/src/components/ListViews/TasksListView.vue +++ b/frontend/src/components/ListViews/TasksListView.vue @@ -9,7 +9,7 @@ resizeColumn: options.resizeColumn, }" row-key="name" - ref="listViewRef" + @update:selections="$emit('selectionsChanged', Array.from($event || []))" > { }) const listBulkActionsRef = ref(null) -const listViewRef = ref(null) - -watch( - () => Array.from(listViewRef.value?.selections || []), - (selections) => { - emit('selectionsChanged', selections) - }, -) defineExpose({ customListActions: computed( diff --git a/frontend/src/pages/Leads.vue b/frontend/src/pages/Leads.vue index b581be4a..e1eb5972 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -249,7 +249,9 @@ @applyFilter="(data) => viewControls.applyFilter(data)" @applyLikeFilter="(data) => viewControls.applyLikeFilter(data)" @likeDoc="(data) => viewControls.likeDoc(data)" - @selectionsChanged="(selections) => viewControls.handleSelectionsChange(selections)" + @selectionsChanged=" + (selections) => viewControls.handleSelectionsChange(selections) + " />