Skip to content

Commit

Permalink
fix: Fixes error in ChatList component (#8266)
Browse files Browse the repository at this point in the history
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
  • Loading branch information
nithindavid and iamsivin committed Nov 1, 2023
1 parent 1e70223 commit 3c7854c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/javascript/dashboard/components/ChatList.vue
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
},
Expand Down

0 comments on commit 3c7854c

Please sign in to comment.