From b3262597c15aaa22a8d007deee496b62b63565e2 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 3 Oct 2024 19:59:07 +0530 Subject: [PATCH] fix: vue 3 followup fixes (#10213) Fixes: CW-3602, CW-3606, CW-3605, CW-3601, CW-3603, CW-3600, CW-3598 - [CW-3602](https://linear.app/chatwoot/issue/CW-3602/chat-list-infinite-loader-fetching-only-odd-numbered-pages) Chat list pagination broken - [CW-3606](https://linear.app/chatwoot/issue/CW-3606/saving-greeting-message-is-not-working-in-inbox-settings) Greetings message not getting saved - [CW-3605](https://linear.app/chatwoot/issue/CW-3605/copy-and-paste-image-attachment-not-working-in-widget) Paste not working on widget - [CW-3601](https://linear.app/chatwoot/issue/CW-3601/edit-category-is-not-working-properly) Edit category not updating - [CW-3603](https://linear.app/chatwoot/issue/CW-3603/delete-filter-is-not-working) Delete filter modal not toggling - [CW-3600](https://linear.app/chatwoot/issue/CW-3600/portal-editor-is-not-working-properly) Portal editor events were flaky - [CW-3598](https://linear.app/chatwoot/issue/CW-3598/rearrange-of-pre-chat-form-fields-throws-an-error) Prechat form re-order bug --------- Co-authored-by: Vishnu Narayanan --- .../dashboard/components/ChatList.vue | 6 -- .../widgets/WootWriter/FullEditor.vue | 20 +++---- .../conversation/EmailTranscriptModal.vue | 20 +++++-- .../conversation/WhatsappTemplates/Modal.vue | 22 ++++--- .../widgets/modal/ConfirmDeleteModal.vue | 19 +++++-- .../modules/contact/ContactMergeModal.vue | 22 ++++--- .../contact/components/AddCustomAttribute.vue | 20 +++++-- .../conversation/contact/CreateContact.vue | 23 +++++--- .../conversation/contact/EditContact.vue | 21 ++++--- .../conversation/contact/NewConversation.vue | 21 +++++-- .../customviews/DeleteCustomViews.vue | 23 +++++--- .../helpcenter/components/AddLocale.vue | 20 +++++-- .../pages/categories/AddCategory.vue | 20 +++++-- .../pages/categories/EditCategory.vue | 20 +++++-- .../pages/categories/NameEmojiInput.vue | 2 +- .../shared/components/GreetingsEditor.vue | 57 +++++-------------- .../widget/components/ChatAttachment.vue | 4 +- 17 files changed, 204 insertions(+), 136 deletions(-) diff --git a/app/javascript/dashboard/components/ChatList.vue b/app/javascript/dashboard/components/ChatList.vue index 1e3b6d967..267b9e422 100644 --- a/app/javascript/dashboard/components/ChatList.vue +++ b/app/javascript/dashboard/components/ChatList.vue @@ -537,12 +537,6 @@ function loadMoreConversations() { return; } - // Increment the current page - store.dispatch('conversationPage/setCurrentPage', { - filter: currentPageFilterKey.value, - page: currentFiltersPage.value + 1, - }); - if (!hasAppliedFiltersOrActiveFolders.value) { fetchConversations(); } else if (hasActiveFolders.value) { diff --git a/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue b/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue index 31b00937a..46763423a 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/FullEditor.vue @@ -61,17 +61,9 @@ export default { plugins: [imagePastePlugin(this.handleImageUpload)], }; }, - computed: { - contentFromEditor() { - if (editorView) { - return ArticleMarkdownSerializer.serialize(editorView.state.doc); - } - return ''; - }, - }, watch: { modelValue(newValue = '') { - if (newValue !== this.contentFromEditor) { + if (newValue !== this.contentFromEditor()) { this.reloadState(); } }, @@ -96,6 +88,12 @@ export default { this.focusEditorInputField(); }, methods: { + contentFromEditor() { + if (editorView) { + return ArticleMarkdownSerializer.serialize(editorView.state.doc); + } + return ''; + }, openFileBrowser() { this.$refs.imageUploadInput.click(); }, @@ -213,8 +211,8 @@ export default { editorView.focus(); }, emitOnChange() { - this.$emit('update:modelValue', this.contentFromEditor); - this.$emit('input', this.contentFromEditor); + this.$emit('update:modelValue', this.contentFromEditor()); + this.$emit('input', this.contentFromEditor()); }, onKeyup() { this.$emit('keyup'); diff --git a/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue b/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue index b1d96ea54..a1c99b69e 100644 --- a/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue +++ b/app/javascript/dashboard/components/widgets/conversation/EmailTranscriptModal.vue @@ -1,20 +1,22 @@