From 711cdf178134a0c9a0dde70db83353d67cea1313 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Fri, 25 Oct 2024 03:14:14 +0530 Subject: [PATCH] feat: reset all state for getList --- src/components/organisms/BrowserWindow.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index d725e9db..823d5724 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -2,7 +2,6 @@ import React, { useCallback, useEffect, useState } from 'react'; import { useSocketStore } from '../../context/socket'; import { Button } from '@mui/material'; import Canvas from "../atoms/canvas"; -import { useBrowserDimensionsStore } from "../../context/browserDimensions"; import { Highlighter } from "../atoms/Highlighter"; import { GenericModal } from '../atoms/GenericModal'; import { useActionContext } from '../../context/browserActions'; @@ -87,6 +86,11 @@ export const BrowserWindow = () => { setListSelector(null); setFields({}); setCurrentListId(null); + setPaginationSelector(''); + setHighlighterData(null); + setShowAttributeModal(false); + setSelectedElement(null); + setAttributeOptions([]); }, []); useEffect(() => { @@ -141,7 +145,7 @@ export const BrowserWindow = () => { // for non-list steps setHighlighterData(data); } - }, [highlighterData, getList, socket, listSelector, paginationMode, paginationType]); + }, [getList, socket, listSelector, paginationMode, paginationType]); useEffect(() => { @@ -209,13 +213,12 @@ export const BrowserWindow = () => { setCurrentListId(Date.now()); setFields({}); } else if (getList === true && listSelector && currentListId) { - const attribute = options[0].value; - const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' : - attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' : - highlighterData.elementInfo?.innerText || ''; // Add fields to the list if (options.length === 1) { const attribute = options[0].value; + const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' : + attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' : + highlighterData.elementInfo?.innerText || ''; const newField: TextStep = { id: Date.now(), type: 'text',