Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

⚡️(frontend) code split livekit-client from the main chunk

lebaudantoine995e6fa41d26
diff --git a/src/frontend/src/components/AppInitialization.tsx b/src/frontend/src/components/AppInitialization.tsx
index 0c5caeff..b59cb9b0 100644
--- a/src/frontend/src/components/AppInitialization.tsx
+++ b/src/frontend/src/components/AppInitialization.tsx
@@ -1,4 +1,3 @@
-import { silenceLiveKitLogs } from '@/utils/livekit'
import { useConfig } from '@/api/useConfig'
import { useAnalytics } from '@/features/analytics/hooks/useAnalytics'
import { useSupport } from '@/features/support/hooks/useSupport'
@@ -9,12 +8,7 @@ export const AppInitialization = () => {
const { data } = useConfig()
useSyncUserPreferencesWithBackend()
- const {
- analytics = {},
- support = {},
- silence_livekit_debug_logs = false,
- custom_css_url = '',
- } = data ?? {}
+ const { analytics = {}, support = {}, custom_css_url = '' } = data ?? {}
useAnalytics(analytics)
useSupport(support)
@@ -29,7 +23,5 @@ export const AppInitialization = () => {
}
}, [custom_css_url])
- silenceLiveKitLogs(silence_livekit_debug_logs)
-
return null
}
diff --git a/src/frontend/src/features/rooms/routes/Room.tsx b/src/frontend/src/features/rooms/routes/Room.tsx
index 1bc22d9e..39f34dfd 100644
--- a/src/frontend/src/features/rooms/routes/Room.tsx
+++ b/src/frontend/src/features/rooms/routes/Room.tsx
@@ -12,6 +12,8 @@ import {
isRoomValid,
normalizeRoomId,
} from '@/features/rooms/utils/isRoomValid'
+import { useConfig } from '@/api/useConfig.ts'
+import { LogLevel, setLogLevel } from 'livekit-client'
const BaseRoom = ({ children }: { children: ReactNode }) => {
return (
@@ -32,6 +34,13 @@ const Room = () => {
const mode = isLoggedIn && history.state?.create ? 'create' : 'join'
const skipJoinScreen = isLoggedIn && mode === 'create'
+ const { data } = useConfig()
+
+ useEffect(() => {
+ const shouldSilenceLogs = data?.silence_livekit_debug_logs || false
+ setLogLevel(shouldSilenceLogs ? LogLevel.silent : LogLevel.debug)
+ }, [data?.silence_livekit_debug_logs])
+
useKeyboardShortcuts()
const clearRouterState = () => {
diff --git a/src/frontend/src/utils/livekit.ts b/src/frontend/src/utils/livekit.ts
index 08acb0dd..e728a619 100644
--- a/src/frontend/src/utils/livekit.ts
+++ b/src/frontend/src/utils/livekit.ts
@@ -1,14 +1,4 @@
-import {
- getBrowser,
- LocalParticipant,
- LogLevel,
- type Participant,
- setLogLevel,
-} from 'livekit-client'
-
-export const silenceLiveKitLogs = (shouldSilenceLogs: boolean) => {
- setLogLevel(shouldSilenceLogs ? LogLevel.silent : LogLevel.debug)
-}
+import { getBrowser, LocalParticipant, type Participant } from 'livekit-client'
export function isFireFox(): boolean {
return getBrowser()?.name === 'Firefox'