feat: emit getText action only if text steps present

This commit is contained in:
karishmas6
2024-08-06 03:24:21 +05:30
parent eb56c5025c
commit d46befb1a6

View File

@@ -61,13 +61,15 @@ export const RightSidePanel = () => {
}, [browserSteps]);
const stopCaptureAndEmitGetTextSettings = useCallback(() => {
stopGetText();
const settings = getTextSettingsObject();
if (browserSteps.length > 0) {
const stopCaptureAndEmitGetTextSettings = useCallback(() => {
stopGetText();
const settings = getTextSettingsObject();
const hasTextSteps = browserSteps.some(step => step.type === 'text');
if (hasTextSteps) {
socket?.emit('action', { action: 'scrapeSchema', settings });
}
}, [stopGetText, getTextSettingsObject, socket]);
}
}, [stopGetText, getTextSettingsObject, socket, browserSteps]);
const captureScreenshot = (fullPage: boolean) => {
const screenshotSettings: ScreenshotSettings = {