Skip to content

Commit

Permalink
fix(messages): minor render enhancements
Browse files Browse the repository at this point in the history
- assign `viewId` on Options API initialising: chatIdentifier is no longer updated at `mounted()` - no cancelled requests
-  don't check system messages for parents: weird, but for federated conversations system conversations `getContext` at the moment response is processed, doesn't contain message parent - false check - system message is rendered as-is

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Mar 5, 2024
1 parent 9efd7e0 commit 4fe60fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/components/MessagesList/MessagesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default {
*/
messagesGroupedByDateByAuthor: {},

viewId: null,
viewId: uniqueId('messagesList'),

/**
* When scrolling to the top of the div .scroller we start loading previous
Expand Down Expand Up @@ -316,7 +316,6 @@ export default {
this.debounceUpdateReadMarkerPosition = debounce(this.updateReadMarkerPosition, 1000)
this.debounceHandleScroll = debounce(this.handleScroll, 50)

this.viewId = uniqueId('messagesList')
this.scrollToBottom()
EventBus.$on('scroll-chat-to-bottom', this.handleScrollChatToBottomEvent)
EventBus.$on('smooth-scroll-chat-to-bottom', this.smoothScrollToBottom)
Expand Down
7 changes: 3 additions & 4 deletions src/store/messagesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,14 @@ const actions = {
processMessage(context, { token, message }) {
const sharedItemsStore = useSharedItemsStore()

if (message.parent && message.systemMessage
&& (message.systemMessage === 'message_deleted'
if (message.systemMessage === 'message_deleted'
|| message.systemMessage === 'reaction'
|| message.systemMessage === 'reaction_deleted'
|| message.systemMessage === 'reaction_revoked'
|| message.systemMessage === 'message_edited')) {
|| message.systemMessage === 'message_edited') {
// If parent message is presented in store and is different, we update it
const parentInStore = context.getters.message(token, message.parent.id)
if (Object.keys(parentInStore).length !== 0 && JSON.stringify(parentInStore) !== JSON.stringify(message.parent)) {
if (Object.keys(parentInStore).length !== 0 && message.parent && JSON.stringify(parentInStore) !== JSON.stringify(message.parent)) {
context.commit('addMessage', { token, message: message.parent })
}

Expand Down

0 comments on commit 4fe60fe

Please sign in to comment.