From 3c7854ccdff9b23ee267208bee3d9a86045cb093 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Thu, 2 Nov 2023 03:23:29 +0530 Subject: [PATCH] fix: Fixes error in ChatList component (#8266) Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> --- app/javascript/dashboard/components/ChatList.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index a77e68465..194bf5e5d 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -410,8 +410,12 @@ export default { }, conversationListPagination() { const conversationsPerPage = 25; + const hasChatsOnView = + this.chatsOnView && + Array.isArray(this.chatsOnView) && + !this.chatsOnView.length; const isNoFiltersOrFoldersAndChatListNotEmpty = - !this.hasAppliedFiltersOrActiveFolders && this.chatsOnView !== []; + !this.hasAppliedFiltersOrActiveFolders && hasChatsOnView; const isUnderPerPage = this.chatsOnView.length < conversationsPerPage && this.activeAssigneeTabCount < conversationsPerPage && @@ -516,10 +520,8 @@ export default { this.chatsOnView = this.conversationList; }, }, - created() { - this.setFiltersFromUISettings(); - }, mounted() { + this.setFiltersFromUISettings(); this.$store.dispatch('setChatStatusFilter', this.activeStatus); this.$store.dispatch('setChatSortFilter', this.activeSortBy); this.resetAndFetchData(); @@ -550,8 +552,8 @@ export default { this.closeAdvanceFiltersModal(); }, setFiltersFromUISettings() { - const { status, order_by: orderBy } = - this.uiSettings.conversations_filter_by; + const { conversations_filter_by: filterBy = {} } = this.uiSettings; + const { status, order_by: orderBy } = filterBy; this.activeStatus = status || wootConstants.STATUS_TYPE.OPEN; this.activeSortBy = orderBy || wootConstants.SORT_BY_TYPE.LATEST; },