Merge branch 'livekit' into tile-updates

This commit is contained in:
Robin
2024-01-03 16:59:12 -05:00
18 changed files with 243 additions and 190 deletions

View File

@@ -32,12 +32,15 @@ import { Subscribe, RemoveSubscribe } from "@react-rxjs/core";
export function subscribe<P, R>(
render: ForwardRefRenderFunction<R, P>,
): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<R>> {
const InnerComponent = forwardRef<R, { p: P }>(({ p }, ref) => (
const Subscriber = forwardRef<R, { p: P }>(({ p }, ref) => (
<RemoveSubscribe>{render(p, ref)}</RemoveSubscribe>
));
Subscriber.displayName = "Subscriber";
// eslint-disable-next-line react/display-name
const OuterComponent = forwardRef<R, P>((p, ref) => (
<Subscribe>
<InnerComponent ref={ref} p={p} />
<Subscriber ref={ref} p={p} />
</Subscribe>
));
// Copy over the component's display name, default props, etc.