mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
Urgent Fix for "Rules of Hooks" error
This commit is contained in:
@@ -6,6 +6,7 @@ import useWebRTC from "../useWebRTC";
|
||||
import useTranscript from "../useTranscript";
|
||||
import { useWebSockets } from "../useWebSockets";
|
||||
import "../../styles/button.css";
|
||||
import getApi from "../../lib/getApi";
|
||||
|
||||
const App = () => {
|
||||
const [stream, setStream] = useState<MediaStream | null>(null);
|
||||
@@ -21,8 +22,9 @@ const App = () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const api = getApi();
|
||||
const transcript = useTranscript();
|
||||
const webRTC = useWebRTC(stream, transcript.response?.id);
|
||||
const webRTC = useWebRTC(stream, transcript.response?.id, api);
|
||||
const webSockets = useWebSockets(transcript.response?.id);
|
||||
|
||||
return (
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
V1TranscriptRecordWebrtcRequest,
|
||||
} from "../api/apis/DefaultApi";
|
||||
import { Configuration } from "../api/runtime";
|
||||
import getApi from "../lib/getApi";
|
||||
|
||||
const useWebRTC = (
|
||||
stream: MediaStream | null,
|
||||
transcriptId: string | null,
|
||||
api: DefaultApi,
|
||||
): Peer => {
|
||||
const [peer, setPeer] = useState<Peer | null>(null);
|
||||
|
||||
@@ -18,8 +18,6 @@ const useWebRTC = (
|
||||
return;
|
||||
}
|
||||
|
||||
const api = getApi();
|
||||
|
||||
let p: Peer = new Peer({ initiator: true, stream: stream });
|
||||
|
||||
p.on("signal", (data: any) => {
|
||||
|
||||
Reference in New Issue
Block a user