rendering once only for the tuned in lines once I am tuned in

This commit is contained in:
talksik
2022-05-18 20:34:33 -05:00
parent 17b27afce6
commit 97c0b29480
2 changed files with 2 additions and 17 deletions
@@ -73,7 +73,7 @@ export function StreamProvider({ children }: { children: React.ReactChild }) {
<StreamProviderContext.Provider value={{ peerMap, userLocalStream }}>
{/* handles stream connections */}
{Object.values(roomsMap).map((line) => {
if (line.tunedInMemberIds.includes(user._id.toString()))
if (line.tunedInMemberIds?.includes(user._id.toString()))
return (
<MemoLineConnector
key={`streamConnector-${line.lineDetails._id.toString()}`}
@@ -81,8 +81,6 @@ export function StreamProvider({ children }: { children: React.ReactChild }) {
line={line}
/>
);
console.log(line.tunedInMemberIds);
})}
{children}
@@ -104,7 +102,6 @@ function LineConnector({
handleAddPeer: (userId: string, peerObj: Peer) => void;
}) {
console.log('rendering this piece of shit');
console.log(line);
useEffectOnce(() => {
console.log('got initial list for this channel that I am tuned into');
@@ -112,13 +109,7 @@ function LineConnector({
console.log(line.tunedInMemberIds);
});
return (
<>
{line.tunedInMemberIds.map((userId) => (
<StreamConnector key={userId} peerUserId={userId} handleAddPeer={handleAddPeer} />
))}
</>
);
return <></>;
}
function StreamConnector({
@@ -134,10 +125,6 @@ function StreamConnector({
useEffect(() => {
console.log('calling all of the initials until this component unmounts');
setInterval(() => {
console.log('still have this mediadevice in memory!');
});
navigator.mediaDevices
.getUserMedia({ video: false, audio: true })
.then((localMediaStream: MediaStream) => {
@@ -6,8 +6,6 @@ import { AuthProvider } from '../providers/AuthProvider';
import { ElectronProvider } from '../providers/ElectronProvider';
import { SocketProvider } from '../providers/SocketProvider';
import ProtectedRoute from './protected/ProtectedRoute';
import { StreamProvider } from '../providers/StreamProvider';
export default function ElectronApp() {
return (
<ElectronProvider>