Skip to content

Commit

Permalink
Fix room connection after refresh (#5734)
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
  • Loading branch information
BykhovDenis authored Jun 5, 2024
1 parent cbc13c7 commit 2627135
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/love-resources/src/components/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
17 changes: 11 additions & 6 deletions plugins/love-resources/src/components/Room.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit 2627135

Please sign in to comment.