Browse Source
Merge pull request #15708 from nextcloud/fix/15704/post-update
fix(router): emit 'route-change' after navigation
pull/15712/head
Maksim Sukharev
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
10 additions and
10 deletions
-
src/App.vue
-
src/components/LeftSidebar/LeftSidebar.vue
-
src/composables/useGetMessages.ts
|
|
|
@ -400,18 +400,22 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
// Update current token in the token store |
|
|
|
this.tokenStore.updateToken(to.params.token) |
|
|
|
} |
|
|
|
|
|
|
|
next() |
|
|
|
} |
|
|
|
|
|
|
|
this.$router.afterEach((to, from) => { |
|
|
|
/** |
|
|
|
* Update current token in the token store |
|
|
|
*/ |
|
|
|
this.tokenStore.updateToken(to.params.token ?? '') |
|
|
|
/** |
|
|
|
* Fires a global event that tells the whole app that the route has changed. The event |
|
|
|
* carries the from and to objects as payload |
|
|
|
*/ |
|
|
|
EventBus.emit('route-change', { from, to }) |
|
|
|
|
|
|
|
next() |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
/** |
|
|
|
* Global before guard, this is called whenever a navigation is triggered. |
|
|
|
|
|
|
|
@ -957,9 +957,6 @@ export default { |
|
|
|
} |
|
|
|
if (from.name === 'conversation') { |
|
|
|
this.$store.dispatch('leaveConversation', { token: from.params.token }) |
|
|
|
if (to.name !== 'conversation') { |
|
|
|
this.tokenStore.updateToken('') |
|
|
|
} |
|
|
|
} |
|
|
|
if (to.name === 'conversation') { |
|
|
|
this.abortSearch() |
|
|
|
|
|
|
|
@ -223,7 +223,6 @@ export function useGetMessagesProvider() { |
|
|
|
} |
|
|
|
|
|
|
|
const focusMessageId = getMessageIdFromHash(to.hash) |
|
|
|
const threadId = +(to.query.threadId ?? 0) |
|
|
|
if (from.hash !== to.hash && focusMessageId !== null) { |
|
|
|
// the hash changed, need to focus/highlight another message
|
|
|
|
contextMessageId.value = focusMessageId |
|
|
|
@ -235,7 +234,7 @@ export function useGetMessagesProvider() { |
|
|
|
contextMessageId.value = conversationLastMessageId.value |
|
|
|
} |
|
|
|
|
|
|
|
await checkContextAndFocusMessage(to.params.token, contextMessageId.value, threadId) |
|
|
|
await checkContextAndFocusMessage(to.params.token, contextMessageId.value, contextThreadId.value) |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|