fix(communication): display project chat state and refresh room visibility
This commit is contained in:
@@ -99,6 +99,9 @@ async function refreshLists() {
|
||||
const scope = scopeVersion
|
||||
await Promise.all([loadRoomLists(scope), loadUnread(scope), loadCollaboration(scope)])
|
||||
}
|
||||
function refreshVisibleLists() {
|
||||
if (!disposed && !document.hidden && !loading.value && hasSession.value) void refreshLists()
|
||||
}
|
||||
|
||||
async function loadRoomPreferences(scope = scopeVersion) {
|
||||
if (!hasSession.value || !currentScope(scope)) return
|
||||
@@ -260,9 +263,15 @@ watch(() => route.query.room, () => {
|
||||
onMounted(() => {
|
||||
mounted = true; void initialize()
|
||||
pollTimer = window.setInterval(pollMessages, 2500)
|
||||
listTimer = window.setInterval(() => { if (!document.hidden && !loading.value) void refreshLists() }, 15000)
|
||||
listTimer = window.setInterval(refreshVisibleLists, 15000)
|
||||
window.addEventListener('focus', refreshVisibleLists)
|
||||
document.addEventListener('visibilitychange', refreshVisibleLists)
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
disposed = true; ++scopeVersion; ++roomVersion; clearInterval(pollTimer); clearInterval(listTimer)
|
||||
window.removeEventListener('focus', refreshVisibleLists)
|
||||
document.removeEventListener('visibilitychange', refreshVisibleLists)
|
||||
})
|
||||
onBeforeUnmount(() => { disposed = true; ++scopeVersion; ++roomVersion; clearInterval(pollTimer); clearInterval(listTimer) })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user