Skip to content

Commit daf9e7d

Browse files
authored
Use correct default states in useLocalParticipant hook (#1169)
1 parent 7091b41 commit daf9e7d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

.changeset/wet-eagles-check.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/components-react": patch
3+
---
4+
5+
Use correct default states in useLocalParticipant hook

packages/react/src/hooks/useLocalParticipant.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ export interface UseLocalParticipantOptions {
2525
export function useLocalParticipant(options: UseLocalParticipantOptions = {}) {
2626
const room = useEnsureRoom(options.room);
2727
const [localParticipant, setLocalParticipant] = React.useState(room.localParticipant);
28+
2829
const [isMicrophoneEnabled, setIsMicrophoneEnabled] = React.useState(
2930
localParticipant.isMicrophoneEnabled,
3031
);
31-
const [isCameraEnabled, setIsCameraEnabled] = React.useState(
32-
localParticipant.isMicrophoneEnabled,
32+
const [isCameraEnabled, setIsCameraEnabled] = React.useState(localParticipant.isCameraEnabled);
33+
const [isScreenShareEnabled, setIsScreenShareEnabled] = React.useState(
34+
localParticipant.isScreenShareEnabled,
3335
);
36+
3437
const [lastMicrophoneError, setLastMicrophoneError] = React.useState(
3538
localParticipant.lastMicrophoneError,
3639
);
3740
const [lastCameraError, setLastCameraError] = React.useState(localParticipant.lastCameraError);
38-
const [isScreenShareEnabled, setIsScreenShareEnabled] = React.useState(
39-
localParticipant.isMicrophoneEnabled,
40-
);
41+
4142
const [microphoneTrack, setMicrophoneTrack] = React.useState<TrackPublication | undefined>(
4243
undefined,
4344
);

0 commit comments

Comments
 (0)