Skip to content

Commit a26d4a8

Browse files
committed
replace useLocalParticipant with useLocalSessionId
This does not replace all occurrences of useLocalParticipant, because in some places we access other properties of the local participant. This commit only replaces occurrences where we only accessed the local participant's session_id.
1 parent 2e22d4d commit a26d4a8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/hooks/useRecording.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
import { useDaily } from './useDaily';
1717
import { useDailyEvent } from './useDailyEvent';
18-
import { useLocalParticipant } from './useLocalParticipant';
18+
import { useLocalSessionId } from './useLocalSessionId';
1919
import { useParticipantIds } from './useParticipantIds';
2020

2121
interface UseRecordingArgs {
@@ -85,7 +85,7 @@ export const useRecording = ({
8585
const state = useRecoilValue(recordingState);
8686
const setState = useSetRecoilState(recordingState);
8787

88-
const localParticipant = useLocalParticipant();
88+
const localSessionId = useLocalSessionId();
8989

9090
const recordingParticipantIds = useParticipantIds({
9191
filter: 'record',
@@ -96,7 +96,7 @@ export const useRecording = ({
9696
useEffect(() => {
9797
const hasRecordingParticipants = recordingParticipantIds.length > 0;
9898
const isLocalParticipantRecording = recordingParticipantIds.includes(
99-
localParticipant?.session_id ?? 'local'
99+
localSessionId ?? 'local'
100100
);
101101
setState((s) => ({
102102
...s,
@@ -119,7 +119,7 @@ export const useRecording = ({
119119
*/
120120
type: hasRecordingParticipants ? 'local' : s?.type,
121121
}));
122-
}, [localParticipant?.session_id, recordingParticipantIds, setState]);
122+
}, [localSessionId, recordingParticipantIds, setState]);
123123

124124
useDailyEvent(
125125
'recording-started',
@@ -131,9 +131,9 @@ export const useRecording = ({
131131
case 'cloud-beta':
132132
case 'cloud': {
133133
if (
134-
localParticipant &&
134+
localSessionId &&
135135
ev.layout?.preset === 'single-participant' &&
136-
ev.layout.session_id !== localParticipant?.session_id
136+
ev.layout.session_id !== localSessionId
137137
) {
138138
isLocalParticipantRecorded = false;
139139
}
@@ -153,7 +153,7 @@ export const useRecording = ({
153153
});
154154
setTimeout(() => onRecordingStarted?.(ev), 0);
155155
},
156-
[localParticipant, onRecordingStarted]
156+
[localSessionId, onRecordingStarted]
157157
)
158158
);
159159
useDailyEvent(

0 commit comments

Comments
 (0)