Skip to content

Commit

Permalink
fix listening to staticConfig changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mitschabaude committed Sep 21, 2022
1 parent 49afee7 commit 23d4de9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 6 additions & 5 deletions ui/jam-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function createApi<T>(
},
// create room with the own identity as the only moderator and speaker
createRoom: (roomId: string, partialRoom?: Partial<RoomType>) =>
createRoom(state, roomId, partialRoom) as Promise<boolean>,
createRoom(state, roomId, partialRoom as any) as Promise<boolean>,

// completely replaces the room, rejects if moderator/speaker array is not set
// only possible for moderators
Expand All @@ -90,13 +90,13 @@ function createApi<T>(
addModerator: (roomId: string, peerId: string) =>
addModerator(state, roomId, peerId) as Promise<boolean>,
addPresenter: (roomId: string, peerId: string) =>
addPresenter(state, roomId, peerId) as Promise<boolean>,
addPresenter(state, roomId, peerId) as Promise<boolean>,
removeSpeaker: (roomId: string, peerId: string) =>
removeSpeaker(state, roomId, peerId) as Promise<boolean>,
removeModerator: (roomId: string, peerId: string) =>
removeModerator(state, roomId, peerId) as Promise<boolean>,
removePresenter: (roomId: string, peerId: string) =>
removePresenter(state, roomId, peerId) as Promise<boolean>,
removePresenter(state, roomId, peerId) as Promise<boolean>,
addAdmin: (peerId: string) => addAdmin(state, peerId) as Promise<boolean>,
removeAdmin: (peerId: string) =>
removeAdmin(state, peerId) as Promise<boolean>,
Expand All @@ -112,7 +112,8 @@ function createApi<T>(
autoJoinOnce: () => dispatch(actions.AUTO_JOIN),

switchCamera: () => dispatch(actions.SWITCH_CAM),
selectMicrophone: (mic: InputDeviceInfo) => dispatch(actions.SELECT_MIC, mic),
selectMicrophone: (mic: InputDeviceInfo) =>
dispatch(actions.SELECT_MIC, mic),

startRecording: () => dispatch('start-recording'),
stopRecording: () => dispatch('stop-recording'),
Expand Down Expand Up @@ -163,7 +164,7 @@ function createJam(
...initialProps,
hasMediasoup: !!staticConfig.sfu,
};
const {state, dispatch, setProps} = declareStateRoot(AppState, props, {
const {state, dispatch, setProps} = declareStateRoot(AppState, props as any, {
state: undefined,
defaultState,
}) as {
Expand Down
4 changes: 1 addition & 3 deletions ui/jam-core/connections/ConnectRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ import {
import {get, populateApiCache} from '../backend';
import {staticConfig} from '../config';
import {actions} from '../state';
import {domEvent} from '../../lib/util';
import {DISCONNECTED, INITIAL} from '../../lib/swarm-health';
import {useStableObject} from '../../lib/state-diff';
let onload = domEvent(window, 'load');

export default function ConnectRoom({myIdentity, swarm}) {
let connectedRoomId = null;
configSwarmIdentity(swarm, myIdentity);
configSwarm(swarm, staticConfig);
useOn(staticConfig, conf => configSwarm(swarm, conf));
useOn(staticConfig, () => configSwarm(swarm, staticConfig));

const identities = {};
let update = useUpdate();
Expand Down

0 comments on commit 23d4de9

Please sign in to comment.