Drop observable-hooks in favor of useBehavior

With this change, views now read every reactive value through `useBehavior`, as
`architecture.md` already prescribes. Where a view reads a plain stream, the view
model now exposes a `Behavior`.
This commit is contained in:
Johannes Marbach
2026-09-28 17:54:50 +02:00
parent addc1b10a0
commit 3f63a6fc3c
22 changed files with 459 additions and 113 deletions
+2 -2
View File
@@ -6,9 +6,9 @@ Please see LICENSE in the repository root for full details.
*/
import { createContext, use, useMemo } from "react";
import { useObservableEagerState } from "observable-hooks";
import { type MediaDevices } from "./state/MediaDevices";
import { useBehavior } from "./useBehavior";
export const MediaDevicesContext = createContext<MediaDevices | undefined>(
undefined,
@@ -35,7 +35,7 @@ export const useEarpieceAudioConfig = (): {
volume: number;
} => {
const devices = useMediaDevices();
const audioOutput = useObservableEagerState(devices.audioOutput.selected$);
const audioOutput = useBehavior(devices.audioOutput.selected$);
const isVirtualEarpiece = audioOutput?.virtualEarpiece ?? false;
return {
// We use only the right speaker (pan = 1) for the earpiece.