@@ -53,10 +53,8 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
5353 const [ isCaptureTextConfirmed , setIsCaptureTextConfirmed ] = useState ( false ) ;
5454 const [ isCaptureListConfirmed , setIsCaptureListConfirmed ] = useState ( false ) ;
5555 const { panelHeight } = useBrowserDimensionsStore ( ) ;
56- const [ isDOMMode , setIsDOMMode ] = useState ( false ) ;
57- const [ currentSnapshot , setCurrentSnapshot ] = useState < any > ( null ) ;
5856
59- const { lastAction, notify, currentWorkflowActionsState, setCurrentWorkflowActionsState, resetInterpretationLog, currentListActionId, setCurrentListActionId, currentTextActionId, setCurrentTextActionId, currentScreenshotActionId, setCurrentScreenshotActionId } = useGlobalInfoStore ( ) ;
57+ const { lastAction, notify, currentWorkflowActionsState, setCurrentWorkflowActionsState, resetInterpretationLog, currentListActionId, setCurrentListActionId, currentTextActionId, setCurrentTextActionId, currentScreenshotActionId, setCurrentScreenshotActionId, updateDOMMode , currentSnapshot , isDOMMode } = useGlobalInfoStore ( ) ;
6058 const {
6159 getText, startGetText, stopGetText,
6260 getList, startGetList, stopGetList,
@@ -87,22 +85,20 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
8785 if ( socket ) {
8886 const domModeHandler = ( data : any ) => {
8987 if ( ! data . userId || data . userId === id ) {
90- setIsDOMMode ( true ) ;
88+ updateDOMMode ( true ) ;
9189 }
9290 } ;
9391
9492 const screenshotModeHandler = ( data : any ) => {
9593 if ( ! data . userId || data . userId === id ) {
96- setIsDOMMode ( false ) ;
97- setCurrentSnapshot ( null ) ;
94+ updateDOMMode ( false ) ;
9895 }
9996 } ;
10097
10198 const domcastHandler = ( data : any ) => {
10299 if ( ! data . userId || data . userId === id ) {
103100 if ( data . snapshotData && data . snapshotData . snapshot ) {
104- setCurrentSnapshot ( data . snapshotData ) ;
105- setIsDOMMode ( true ) ;
101+ updateDOMMode ( true , data . snapshotData ) ;
106102 }
107103 }
108104 } ;
@@ -117,7 +113,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
117113 socket . off ( "domcast" , domcastHandler ) ;
118114 } ;
119115 }
120- } , [ socket , id ] ) ;
116+ } , [ socket , id , updateDOMMode ] ) ;
121117
122118 useEffect ( ( ) => {
123119 if ( socket ) {
@@ -461,6 +457,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
461457 resetInterpretationLog ( ) ;
462458 finishAction ( 'text' ) ;
463459 onFinishCapture ( ) ;
460+ clientSelectorGenerator . cleanup ( ) ;
464461 } , [ stopGetText , getTextSettingsObject , socket , browserSteps , confirmedTextSteps , resetInterpretationLog , finishAction , notify , onFinishCapture , t ] ) ;
465462
466463 const getListSettingsObject = useCallback ( ( ) => {
@@ -512,6 +509,8 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
512509
513510 const stopCaptureAndEmitGetListSettings = useCallback ( ( ) => {
514511 const settings = getListSettingsObject ( ) ;
512+
513+ console . log ( "rrwebSnapshotHandler" , settings ) ;
515514
516515 const latestListStep = getLatestListStep ( browserSteps ) ;
517516 if ( latestListStep && settings ) {
@@ -657,6 +656,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
657656
658657 setCurrentTextActionId ( '' ) ;
659658 setIsCaptureTextConfirmed ( false ) ;
659+ clientSelectorGenerator . cleanup ( ) ;
660660 notify ( 'error' , t ( 'right_panel.errors.capture_text_discarded' ) ) ;
661661 } , [ currentTextActionId , browserSteps , stopGetText , deleteStepsByActionId , notify , t ] ) ;
662662
@@ -687,6 +687,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
687687 setCaptureStage ( 'initial' ) ;
688688 setCurrentListActionId ( '' ) ;
689689 setIsCaptureListConfirmed ( false ) ;
690+ clientSelectorGenerator . cleanup ( ) ;
690691 notify ( 'error' , t ( 'right_panel.errors.capture_list_discarded' ) ) ;
691692 } , [ currentListActionId , browserSteps , stopGetList , deleteStepsByActionId , resetListState , setShowPaginationOptions , setShowLimitOptions , setCaptureStage , notify , t ] ) ;
692693
@@ -705,6 +706,7 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
705706 stopGetScreenshot ( ) ;
706707 resetInterpretationLog ( ) ;
707708 finishAction ( 'screenshot' ) ;
709+ clientSelectorGenerator . cleanup ( ) ;
708710 onFinishCapture ( ) ;
709711 } ;
710712
0 commit comments