Skip to content

Commit 7456763

Browse files
committed
Fix memory leak in AppInitialization and remove unused import
- Add cleanup function for CSS link element to prevent memory leak - Remove unused log import from VideoConference component
1 parent 97f5e26 commit 7456763

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/frontend/src/components/AppInitialization.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,19 @@ export const AppInitialization = () => {
2020
useSupport(support)
2121

2222
useEffect(() => {
23-
if (custom_css_url) {
24-
const link = document.createElement('link')
25-
link.href = custom_css_url
26-
link.id = 'meet-custom-css'
27-
link.rel = 'stylesheet'
28-
document.head.appendChild(link)
23+
if (!custom_css_url) return
24+
25+
const link = document.createElement('link')
26+
link.href = custom_css_url
27+
link.id = 'meet-custom-css'
28+
link.rel = 'stylesheet'
29+
document.head.appendChild(link)
30+
31+
return () => {
32+
const existingLink = document.getElementById('meet-custom-css')
33+
if (existingLink) {
34+
existingLink.remove()
35+
}
2936
}
3037
}, [custom_css_url])
3138

src/frontend/src/features/rooms/livekit/prefabs/VideoConference.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
isEqualTrackRef,
44
isTrackReference,
55
isWeb,
6-
log,
76
} from '@livekit/components-core'
87
import { RoomEvent, Track } from 'livekit-client'
98
import * as React from 'react'

0 commit comments

Comments
 (0)