Fix room connection after refresh (#5734)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-06-05 18:12:48 +05:00 committed by GitHub
parent cbc13c7b14
commit 26271359bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View File

@ -30,7 +30,7 @@
<div class="hulyPanels-container" class:left-divider={$screenSharing || $currentRoom?.type === RoomType.Video}>
{#if ($currentRoom !== undefined && $screenSharing) || $currentRoom?.type === RoomType.Video}
<RoomComponent withVideo={$currentRoom.type === RoomType.Video} room={$currentRoom._id} />
<RoomComponent withVideo={$currentRoom.type === RoomType.Video} room={$currentRoom} />
{:else}
<Hall bind:visibleNav {navFloat} {appsDirection} />
{/if}

View File

@ -14,10 +14,10 @@
-->
<script lang="ts">
import { Analytics } from '@hcengineering/analytics'
import { Ref } from '@hcengineering/core'
import { Label, Loading, deviceOptionsStore as deviceInfo } from '@hcengineering/ui'
import { personByIdStore } from '@hcengineering/contact-resources'
import { Room as TypeRoom } from '@hcengineering/love'
import { getMetadata } from '@hcengineering/platform'
import { Label, Loading, deviceOptionsStore as deviceInfo } from '@hcengineering/ui'
import {
LocalParticipant,
LocalTrackPublication,
@ -31,13 +31,13 @@
} from 'livekit-client'
import { onDestroy, onMount, tick } from 'svelte'
import love from '../plugin'
import { currentRoom, infos } from '../stores'
import { awaitConnect, isConnected, isCurrentInstanceConnected, lk, screenSharing } from '../utils'
import { currentRoom, infos, invites, myInfo, myRequests } from '../stores'
import { awaitConnect, isConnected, isCurrentInstanceConnected, lk, screenSharing, tryConnect } from '../utils'
import ControlBar from './ControlBar.svelte'
import ParticipantView from './ParticipantView.svelte'
export let withVideo: boolean
export let room: Ref<TypeRoom>
export let room: TypeRoom
interface ParticipantData {
_id: string
@ -214,6 +214,11 @@
configured = true
if (!$isConnected && !$isCurrentInstanceConnected) {
const info = $infos.filter((p) => p.room === room._id)
await tryConnect($personByIdStore, $myInfo, room, info, $myRequests, $invites)
}
await awaitConnect()
for (const participant of lk.remoteParticipants.values()) {
attachParticipant(participant)
@ -259,7 +264,7 @@
onDestroy(
infos.subscribe((data) => {
for (const info of data) {
if (info.room !== room) continue
if (info.room !== room._id) continue
const current = participants.find((p) => p._id === info.person)
if (current !== undefined) continue
const value: ParticipantData = {