preventing renders really complicated

This commit is contained in:
talksik
2022-05-13 20:14:16 -05:00
parent e977b4a901
commit adb0ff782d
4 changed files with 39 additions and 20 deletions
@@ -0,0 +1 @@
// Manage user's stream and
@@ -0,0 +1,20 @@
/**
* take in the rooms
* which ones am I in
* on mounting, call all other folks
*
* on someone untuning from a line and they are not in any other lines
* if they are in the peer connections that we have stored, then destroy them and remove them
*
* on someone tuning into a line, they are seen in the list of ids for me
* if they are not in my local peers storage then I want to initiate connections so that I can communicate with them
*
*
* on me untuning from a line, we need to destroy the right one from the store of peers and destroy the connection
*
*
* on me changing my media devices, I need to replace stream for all peer connections so that they get a whole new set
*
*
* listen for any calls to me, as well as any answers back to me
*/
@@ -28,7 +28,7 @@ type LineIdToMasterLine = {
interface IRealTimeRoomProvider {
roomsMap: LineIdToMasterLine;
selectedLine?: MasterLineData;
selectedLineId?: string;
handleSelectLine: (newLineId: string) => void;
}
@@ -46,7 +46,7 @@ export function RealTimeRoomProvider({ children }: { children: React.ReactChild
const { $ws } = useSockets();
const [realTimeRoomMap, setRealTimeRoomMap] = useState<LineIdToMasterLine>({});
const [selectedLine, setSelectedLine] = useState<MasterLineData>();
const [selectedLineId, setSelectedLineId] = useState<string>();
useEffect(() => {
/**
@@ -203,14 +203,14 @@ export function RealTimeRoomProvider({ children }: { children: React.ReactChild
const handleSelectLine = useCallback(
(newLineIdToSelect: string) => {
toast('selecting line!! NOT IMPLEMENTED');
setSelectedLine(realTimeRoomMap[newLineIdToSelect]);
setSelectedLineId(newLineIdToSelect);
},
[setSelectedLine, realTimeRoomMap],
[setSelectedLineId],
);
return (
<RealTimeRoomContext.Provider
value={{ roomsMap: realTimeRoomMap, handleSelectLine, selectedLine }}
value={{ roomsMap: realTimeRoomMap, handleSelectLine, selectedLineId }}
>
{children}
</RealTimeRoomContext.Provider>