Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(chrome-extension): derive permission UI from grant not selection
Richie McIlroyb38c990fee7b
diff --git a/apps/chrome-extension/src/popup/components/camera-selector.tsx b/apps/chrome-extension/src/popup/components/camera-selector.tsxindex ad0c9f652..0d2eab167 100644--- a/apps/chrome-extension/src/popup/components/camera-selector.tsx+++ b/apps/chrome-extension/src/popup/components/camera-selector.tsx@@ -39,14 +39,15 @@ export const CameraSelector = ({}: CameraSelectorProps) => {const cameraEnabled = selectedCameraId !== null;const triggerRef = useRef<HTMLButtonElement>(null);- const { state: permissionState, requestPermission } =- useMediaPermission("camera");-- const permissionSupported = permissionState !== "unsupported";- const hasDeviceAccess = availableCameras.length > 0;- const hasAccess = permissionGranted || hasDeviceAccess || cameraEnabled;- const shouldRequestPermission =- permissionSupported && permissionState !== "granted" && !hasAccess;+ const { requestPermission } = useMediaPermission("camera");++ // "Has access" tracks only the real browser grant — a live device or the+ // authoritative permission flag the offscreen document reports — never a+ // remembered device selection. A remembered camera must not hide that+ // Chrome has reset the grant, otherwise the panel shows an empty picker+ // with no way to recover from here.+ const hasAccess = permissionGranted || availableCameras.length > 0;+ const shouldRequestPermission = !hasAccess;const statusPillDisabled = !shouldRequestPermission && !cameraEnabled;diff --git a/apps/chrome-extension/src/popup/components/microphone-selector.tsx b/apps/chrome-extension/src/popup/components/microphone-selector.tsxindex 94d8979a2..4f3106147 100644--- a/apps/chrome-extension/src/popup/components/microphone-selector.tsx+++ b/apps/chrome-extension/src/popup/components/microphone-selector.tsx@@ -39,14 +39,14 @@ export const MicrophoneSelector = ({}: MicrophoneSelectorProps) => {const micEnabled = selectedMicId !== null;const triggerRef = useRef<HTMLButtonElement>(null);- const { state: permissionState, requestPermission } =- useMediaPermission("microphone");-- const permissionSupported = permissionState !== "unsupported";- const hasDeviceAccess = availableMics.length > 0;- const hasAccess = permissionGranted || hasDeviceAccess || micEnabled;- const shouldRequestPermission =- permissionSupported && permissionState !== "granted" && !hasAccess;+ const { requestPermission } = useMediaPermission("microphone");++ // "Has access" tracks only the real browser grant — a live device or the+ // authoritative permission flag the offscreen document reports — never a+ // remembered/default mic selection. The mic defaults to on, so keying off+ // the selection would permanently hide a reset grant behind an "On" pill.+ const hasAccess = permissionGranted || availableMics.length > 0;+ const shouldRequestPermission = !hasAccess;const statusPillDisabled =disabled || (!shouldRequestPermission && !micEnabled);