Compare commits

..

1 Commits

Author SHA1 Message Date
lebaudantoine 7dbe67264e wip lazy load feature flag 2026-11-15 00:53:37 +01:00
8 changed files with 38 additions and 8 deletions
-2
View File
@@ -61,8 +61,6 @@ La Suite Meet is fully self-hostable and released under the MIT License, ensurin
We’re continuously adding new features to enhance your experience, with the latest updates coming soon!
⭐ **Find La Suite Meet useful?** Click the Star button at the top right of this page. It helps other people and public organisations discover the project.
### 🚀 Major roll out to all French public servants
On the 29th of January 2026, Prime Minister Sébastien Lecornu, announced the full deployment of Visio—the French government’s dedicated Meet platform—to all public servants. ([Source in English](https://www.nytimes.com/2026/01/29/world/europe/france-zoom-alternative-visio.html))
@@ -0,0 +1,32 @@
import { useEffect, useState } from 'react'
import { getPosthog } from '../utils'
import { useIsAnalyticsEnabled } from './useIsAnalyticsEnabled'
/**
* Same contract as `useFeatureFlagEnabled` from 'posthog-js/react', without a
* static import of posthog-js: that import puts the whole SDK on the critical
* path of every screen, defeating the lazy `getPosthog()`.
*/
export const useFeatureFlagEnabled = (flag: string): boolean | undefined => {
const isAnalyticsEnabled = useIsAnalyticsEnabled()
const [enabled, setEnabled] = useState<boolean | undefined>(undefined)
useEffect(() => {
if (!isAnalyticsEnabled) return
let cancelled = false
let unsubscribe: (() => void) | undefined
void getPosthog().then((ph) => {
if (cancelled) return
setEnabled(ph.isFeatureEnabled(flag))
unsubscribe = ph.onFeatureFlags(() =>
setEnabled(ph.isFeatureEnabled(flag))
)
})
return () => {
cancelled = true
unsubscribe?.()
}
}, [flag, isAnalyticsEnabled])
return enabled
}
@@ -1,4 +1,4 @@
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
import type { RecordingMode } from '../types'
import { useIsRecordingModeEnabled } from './useIsRecordingModeEnabled'
@@ -1,4 +1,4 @@
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
import type { RecordingMode } from '../types'
import { useIsRecordingModeEnabled } from './useIsRecordingModeEnabled'
@@ -1,4 +1,4 @@
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
import { FeatureFlags } from '@/features/analytics/enums'
@@ -1,4 +1,4 @@
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
import { FeatureFlags } from '@/features/analytics/enums'
import useKonami from '@/features/rooms/livekit/hooks/useKonami'
@@ -1,4 +1,4 @@
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
import { FeatureFlags } from '@/features/analytics/enums'
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
import { isMobileBrowser } from '@livekit/components-core'
@@ -1,4 +1,4 @@
import { useFeatureFlagEnabled } from 'posthog-js/react'
import { useFeatureFlagEnabled } from '@/features/analytics/hooks/useFeatureFlagEnabled'
import { FeatureFlags } from '@/features/analytics/enums'
import { useIsAnalyticsEnabled } from '@/features/analytics/hooks/useIsAnalyticsEnabled'
import { useConfig } from '@/api/useConfig'