From 693901c2997454bc8dc5f5639d113dc6c554c4f0 Mon Sep 17 00:00:00 2001 From: KaustubhKumar05 Date: Thu, 7 Nov 2024 12:43:30 +0530 Subject: [PATCH] fix: clean up vb state on reset --- packages/roomkit-react/src/Prebuilt/App.tsx | 4 +++- packages/roomkit-react/src/Prebuilt/AppStateContext.tsx | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/roomkit-react/src/Prebuilt/App.tsx b/packages/roomkit-react/src/Prebuilt/App.tsx index 8010a58115..8c62917fde 100644 --- a/packages/roomkit-react/src/Prebuilt/App.tsx +++ b/packages/roomkit-react/src/Prebuilt/App.tsx @@ -1,5 +1,6 @@ import React, { MutableRefObject, useEffect, useRef } from 'react'; import { HMSStatsStoreWrapper, HMSStoreWrapper, IHMSNotifications } from '@100mslive/hms-video-store'; +import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background'; import { Layout, Logo, Screens, Theme, Typography } from '@100mslive/types-prebuilt'; import { match } from 'ts-pattern'; import { @@ -49,7 +50,7 @@ import { // @ts-ignore: No implicit Any import { FeatureFlags } from './services/FeatureFlags'; // @ts-ignore: No implicit Any -import { DEFAULT_PORTAL_CONTAINER } from './common/constants'; +import { APP_DATA, DEFAULT_PORTAL_CONTAINER } from './common/constants'; export type HMSPrebuiltOptions = { userName?: string; @@ -131,6 +132,7 @@ export const HMSPrebuilt = React.forwardRef { VBHandler.reset(); + reactiveStore?.current?.hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.NONE); reactiveStore?.current?.hmsActions.leave(); }; }, []); diff --git a/packages/roomkit-react/src/Prebuilt/AppStateContext.tsx b/packages/roomkit-react/src/Prebuilt/AppStateContext.tsx index 99aadb311c..43a5109089 100644 --- a/packages/roomkit-react/src/Prebuilt/AppStateContext.tsx +++ b/packages/roomkit-react/src/Prebuilt/AppStateContext.tsx @@ -1,5 +1,6 @@ import React, { useContext, useEffect } from 'react'; import { usePreviousDistinct } from 'react-use'; +import { HMSVirtualBackgroundTypes } from '@100mslive/hms-virtual-background'; import { match, P } from 'ts-pattern'; import { HMSRoomState, selectRoomState, useHMSActions, useHMSStore } from '@100mslive/react-sdk'; import { VBHandler } from './components/VirtualBackground/VBHandler'; @@ -79,6 +80,7 @@ export const useAppStateManager = () => { .otherwise(() => PrebuiltStates.MEETING); }); VBHandler.reset(); + hmsActions.setAppData(APP_DATA.background, HMSVirtualBackgroundTypes.NONE); redirectToLeave(1000); // to clear toasts after 1 second }, )