Conform `src/hooks/*` code to `strictNullChecks` (#10460)

pull/28217/head
Michael Telatynski 2023-03-27 14:45:46 +01:00 committed by GitHub
parent afb2cb93f2
commit 065e970325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -42,7 +42,9 @@ export const useAudioDeviceSelection = (
if (shouldRequestPermissionsRef.current) { if (shouldRequestPermissionsRef.current) {
shouldRequestPermissionsRef.current = false; shouldRequestPermissionsRef.current = false;
requestMediaPermissions(false).then((stream: MediaStream | undefined) => { requestMediaPermissions(false).then((stream: MediaStream | undefined) => {
MediaDeviceHandler.getDevices().then(({ audioinput }) => { MediaDeviceHandler.getDevices().then((devices) => {
if (!devices) return;
const { audioinput } = devices;
MediaDeviceHandler.getDefaultDevice(audioinput); MediaDeviceHandler.getDefaultDevice(audioinput);
const deviceFromSettings = MediaDeviceHandler.getAudioInput(); const deviceFromSettings = MediaDeviceHandler.getAudioInput();
const device = const device =

View File

@ -166,9 +166,10 @@ export const usePublicRoomDirectory = (): {
}, [protocols]); }, [protocols]);
useEffect(() => { useEffect(() => {
localStorage.setItem(LAST_SERVER_KEY, config?.roomServer); if (!config) return;
if (config?.instanceId) { localStorage.setItem(LAST_SERVER_KEY, config.roomServer);
localStorage.setItem(LAST_INSTANCE_KEY, config?.instanceId); if (config.instanceId) {
localStorage.setItem(LAST_INSTANCE_KEY, config.instanceId);
} else { } else {
localStorage.removeItem(LAST_INSTANCE_KEY); localStorage.removeItem(LAST_INSTANCE_KEY);
} }