feat: reset all state for getList
This commit is contained in:
@@ -2,7 +2,6 @@ import React, { useCallback, useEffect, useState } from 'react';
|
|||||||
import { useSocketStore } from '../../context/socket';
|
import { useSocketStore } from '../../context/socket';
|
||||||
import { Button } from '@mui/material';
|
import { Button } from '@mui/material';
|
||||||
import Canvas from "../atoms/canvas";
|
import Canvas from "../atoms/canvas";
|
||||||
import { useBrowserDimensionsStore } from "../../context/browserDimensions";
|
|
||||||
import { Highlighter } from "../atoms/Highlighter";
|
import { Highlighter } from "../atoms/Highlighter";
|
||||||
import { GenericModal } from '../atoms/GenericModal';
|
import { GenericModal } from '../atoms/GenericModal';
|
||||||
import { useActionContext } from '../../context/browserActions';
|
import { useActionContext } from '../../context/browserActions';
|
||||||
@@ -87,6 +86,11 @@ export const BrowserWindow = () => {
|
|||||||
setListSelector(null);
|
setListSelector(null);
|
||||||
setFields({});
|
setFields({});
|
||||||
setCurrentListId(null);
|
setCurrentListId(null);
|
||||||
|
setPaginationSelector('');
|
||||||
|
setHighlighterData(null);
|
||||||
|
setShowAttributeModal(false);
|
||||||
|
setSelectedElement(null);
|
||||||
|
setAttributeOptions([]);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -141,7 +145,7 @@ export const BrowserWindow = () => {
|
|||||||
// for non-list steps
|
// for non-list steps
|
||||||
setHighlighterData(data);
|
setHighlighterData(data);
|
||||||
}
|
}
|
||||||
}, [highlighterData, getList, socket, listSelector, paginationMode, paginationType]);
|
}, [getList, socket, listSelector, paginationMode, paginationType]);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -209,13 +213,12 @@ export const BrowserWindow = () => {
|
|||||||
setCurrentListId(Date.now());
|
setCurrentListId(Date.now());
|
||||||
setFields({});
|
setFields({});
|
||||||
} else if (getList === true && listSelector && currentListId) {
|
} 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
|
// Add fields to the list
|
||||||
if (options.length === 1) {
|
if (options.length === 1) {
|
||||||
const attribute = options[0].value;
|
const attribute = options[0].value;
|
||||||
|
const data = attribute === 'href' ? highlighterData.elementInfo?.url || '' :
|
||||||
|
attribute === 'src' ? highlighterData.elementInfo?.imageUrl || '' :
|
||||||
|
highlighterData.elementInfo?.innerText || '';
|
||||||
const newField: TextStep = {
|
const newField: TextStep = {
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
|||||||
Reference in New Issue
Block a user