From 9203a0316349463c97a8aca4da2ae5fed05526de Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 27 Oct 2024 19:27:51 +0530 Subject: [PATCH] feat: capture stage --- src/context/browserActions.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/context/browserActions.tsx b/src/context/browserActions.tsx index 7ff6f377..ef303f82 100644 --- a/src/context/browserActions.tsx +++ b/src/context/browserActions.tsx @@ -3,7 +3,7 @@ import { useSocketStore } from './socket'; export type PaginationType = 'scrollDown' | 'scrollUp' | 'clickNext' | 'clickLoadMore' | 'none' | ''; export type LimitType = '10' | '100' | 'custom' | ''; -export type CaptureStage = 'initial' | 'pagination' | 'limit' | 'complete'; +export type CaptureStage = 'initial' | 'pagination' | 'limit' | 'complete' | ''; interface ActionContextProps { getText: boolean; @@ -42,7 +42,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const [paginationType, setPaginationType] = useState(''); const [limitType, setLimitType] = useState(''); const [customLimit, setCustomLimit] = useState(''); - const [captureStage, setCaptureStage] = useState('initial'); // New captureStage state + const [captureStage, setCaptureStage] = useState('initial'); const { socket } = useSocketStore(); @@ -70,6 +70,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { const startGetList = () => { setGetList(true); socket?.emit('setGetList', { getList: true }); + setCaptureStage('initial'); } const stopGetList = () => { @@ -78,7 +79,7 @@ export const ActionProvider = ({ children }: { children: ReactNode }) => { setPaginationType(''); setLimitType(''); setCustomLimit(''); - setCaptureStage('initial'); // Reset captureStage when stopping getList + setCaptureStage('complete'); }; const startGetScreenshot = () => setGetScreenshot(true);