diff options
author | Grigorii K. Shartsev <me@shgk.me> | 2023-06-16 20:00:40 +0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-16 20:00:40 +0500 |
commit | 73d8225f3b5ef84711e1d535e6381cb7aad04ddb (patch) | |
tree | b526fda3d068bdd0d23ea75ecd0aa230ca9ef6d5 /src | |
parent | 61001581bedd9ad2dbb4f90cf9e1a474a296b099 (diff) | |
parent | a87939f6f11d9697fa8edaa5cdad025e370f7d1d (diff) |
Merge pull request #9796 from nextcloud/backport/9795/stable27
[stable27] fix(LeftSidebar): fix scroll with new created conversations
Diffstat (limited to 'src')
-rw-r--r-- | src/components/LeftSidebar/LeftSidebar.vue | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/LeftSidebar/LeftSidebar.vue b/src/components/LeftSidebar/LeftSidebar.vue index 1d5c91fbb..592d4ce88 100644 --- a/src/components/LeftSidebar/LeftSidebar.vue +++ b/src/components/LeftSidebar/LeftSidebar.vue @@ -41,7 +41,7 @@ :title="t('spreed', 'Conversations')" /> <Conversation v-for="item of conversationsList" :key="item.id" - ref="conversations" + :ref="`conversation-${item.token}`" :item="item" /> <template v-if="!initialisedConversations"> <LoadingPlaceholder type="conversations" /> @@ -548,7 +548,12 @@ export default { scrollToConversation(token) { this.$nextTick(() => { - const conversation = this.$refs.conversations[this.conversationsList.findIndex(item => item.token === token)].$el + // In Vue 2 ref on v-for is always an array and its order is not guaranteed to match the order of v-for source + // See https://github.com/vuejs/vue/issues/4952#issuecomment-280661367 + // Fixed in Vue 3 + // Temp solution - use unique ref name for each v-for element. The value is still array but with one element + // TODO: Vue3: remove [0] here or use object for template refs + const conversation = this.$refs[`conversation-${token}`]?.[0].$el if (!conversation) { return } |