Skip to content

Commit 6848a4e

Browse files
committed
(UI) fix messages flicker when changing room
1 parent 752bfdb commit 6848a4e

File tree

1 file changed

+57
-51
lines changed

1 file changed

+57
-51
lines changed

src/ChatWindow/Room.vue

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -46,60 +46,62 @@
4646
</transition>
4747
</div>
4848
<div ref="scrollContainer" class="container-scroll">
49+
<loader :show="loadingMessages"></loader>
4950
<div class="messages-container">
50-
<loader :show="loadingMessages"></loader>
51-
<transition name="fade-message">
52-
<div class="text-started" v-if="showNoMessages">
53-
{{ textMessages.MESSAGES_EMPTY }}
54-
</div>
55-
<div class="text-started" v-if="showMessagesStarted">
56-
{{ textMessages.CONVERSATION_STARTED }} {{ messages[0].date }}
57-
</div>
58-
</transition>
59-
<transition name="fade-message">
60-
<infinite-loading
61-
v-if="messages.length"
62-
spinner="spiral"
63-
direction="top"
64-
@infinite="loadMoreMessages"
65-
>
66-
<div slot="spinner">
67-
<loader :show="true" :infinite="true"></loader>
51+
<div :class="{ 'messages-hidden': loadingMessages }">
52+
<transition name="fade-message">
53+
<div class="text-started" v-if="showNoMessages">
54+
{{ textMessages.MESSAGES_EMPTY }}
6855
</div>
69-
<div slot="no-results"></div>
70-
<div slot="no-more"></div>
71-
</infinite-loading>
72-
</transition>
73-
<transition-group name="fade-message">
74-
<div v-for="(message, i) in messages" :key="message._id">
75-
<message
76-
:currentUserId="currentUserId"
77-
:message="message"
78-
:index="i"
79-
:messages="messages"
80-
:editedMessage="editedMessage"
81-
:messageActions="messageActions"
82-
:roomUsers="room.users"
83-
:textMessages="textMessages"
84-
:roomFooterRef="$refs.roomFooter"
85-
:newMessages="newMessages"
86-
:showReactionEmojis="showReactionEmojis"
87-
:emojisList="emojisList"
88-
:hideOptions="hideOptions"
89-
@messageActionHandler="messageActionHandler"
90-
@openFile="openFile"
91-
@addNewMessage="addNewMessage"
92-
@sendMessageReaction="sendMessageReaction"
93-
@hideOptions="hideOptions = $event"
94-
></message>
95-
</div>
96-
</transition-group>
97-
</div>
98-
<transition name="bounce">
99-
<div class="icon-scroll" v-if="scrollIcon" @click="scrollToBottom">
100-
<svg-icon name="dropdown" param="scroll" />
56+
<div class="text-started" v-if="showMessagesStarted">
57+
{{ textMessages.CONVERSATION_STARTED }} {{ messages[0].date }}
58+
</div>
59+
</transition>
60+
<transition name="fade-message">
61+
<infinite-loading
62+
v-if="messages.length"
63+
spinner="spiral"
64+
direction="top"
65+
@infinite="loadMoreMessages"
66+
>
67+
<div slot="spinner">
68+
<loader :show="true" :infinite="true"></loader>
69+
</div>
70+
<div slot="no-results"></div>
71+
<div slot="no-more"></div>
72+
</infinite-loading>
73+
</transition>
74+
<transition-group name="fade-message">
75+
<div v-for="(message, i) in messages" :key="message._id">
76+
<message
77+
:currentUserId="currentUserId"
78+
:message="message"
79+
:index="i"
80+
:messages="messages"
81+
:editedMessage="editedMessage"
82+
:messageActions="messageActions"
83+
:roomUsers="room.users"
84+
:textMessages="textMessages"
85+
:roomFooterRef="$refs.roomFooter"
86+
:newMessages="newMessages"
87+
:showReactionEmojis="showReactionEmojis"
88+
:emojisList="emojisList"
89+
:hideOptions="hideOptions"
90+
@messageActionHandler="messageActionHandler"
91+
@openFile="openFile"
92+
@addNewMessage="addNewMessage"
93+
@sendMessageReaction="sendMessageReaction"
94+
@hideOptions="hideOptions = $event"
95+
></message>
96+
</div>
97+
</transition-group>
98+
<transition name="bounce">
99+
<div class="icon-scroll" v-if="scrollIcon" @click="scrollToBottom">
100+
<svg-icon name="dropdown" param="scroll" />
101+
</div>
102+
</transition>
101103
</div>
102-
</transition>
104+
</div>
103105
</div>
104106
<div ref="roomFooter" class="room-footer">
105107
<transition name="slide-up">
@@ -785,4 +787,8 @@ textarea {
785787
pointer-events: none !important;
786788
transform: none !important;
787789
}
790+
791+
.messages-hidden {
792+
opacity: 0;
793+
}
788794
</style>

0 commit comments

Comments
 (0)