not the pattern I want but have to think about it more

This commit is contained in:
talksik
2022-05-30 12:56:01 -05:00
parent 74dc84826f
commit 276c40330c
2 changed files with 22 additions and 0 deletions
@@ -28,6 +28,7 @@ import useAuth from '../providers/AuthProvider';
import { useImmer } from 'use-immer';
import { useSearchConversations } from '../util/clientSearch';
import { useSnackbar } from 'notistack';
import useStreamHandler from '../hooks/useStreamHandler';
interface ITerminalContext {
conversationMap: ConversationMap;
@@ -192,6 +193,9 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) {
// return undefined;
}, [selectedConversationId, conversationMap, enqueueSnackbar]);
// handles stream and device stuff
useStreamHandler(selectedConversation);
// handle create or open existing conversation
// not 100% consistent to the second, but still works...don't need atomicity
const handleQuickDial = useCallback(
@@ -0,0 +1,18 @@
import React, { useEffect } from 'react';
import Conversation from '@nirvana/core/src/models/conversation.model';
import { useMediaDevices } from 'react-use';
export default function useStreamHandler(selectedConversation: Conversation) {
const devices = useMediaDevices();
console.log('devices');
console.log(devices);
useEffect(() => {
if (selectedConversation) {
console.log('handle stream for this newly selected conversation');
}
}, [selectedConversation]);
}