Skip to content

Commit 686a82c

Browse files
committed
update callObject instance when frame id changed
1 parent 7b916ac commit 686a82c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/DailyProvider.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ export const DailyProvider: React.FC<React.PropsWithChildren<Props>> = ({
4141
);
4242
const eventsMap = useRef<EventsMap>({});
4343

44+
/**
45+
* Update callObject reference, in case externally created instance has changed.
46+
*/
47+
useEffect(() => {
48+
if (
49+
'callObject' in props &&
50+
callObject &&
51+
props.callObject &&
52+
// TODO: Replace _callFrameId check with something "official".
53+
// @ts-ignore
54+
callObject?._callFrameId !== props?.callObject?._callFrameId
55+
) {
56+
setCallObject(props.callObject);
57+
}
58+
}, [callObject, props]);
59+
4460
/**
4561
* Generic event handler to loop through registered event callbacks.
4662
*/

0 commit comments

Comments
 (0)