From 2b018001889af1396e86a4c623a79444f7b6f960 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 28 Oct 2024 06:55:13 +0530 Subject: [PATCH] feat: addListStep during pagination --- src/components/organisms/BrowserWindow.tsx | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/components/organisms/BrowserWindow.tsx b/src/components/organisms/BrowserWindow.tsx index 80dfec7f..8825b7c0 100644 --- a/src/components/organisms/BrowserWindow.tsx +++ b/src/components/organisms/BrowserWindow.tsx @@ -198,18 +198,6 @@ export const BrowserWindow = () => { } if (getList === true) { - // Handle pagination mode logic only when a list is being processed - if (paginationMode) { - // Only allow selection in pagination mode if type is not empty, 'scrollDown', or 'scrollUp' - if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') { - setPaginationSelector(highlighterData.selector); - notify(`info`, `Pagination element selected successfully.`); - addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); - } - return; - } - - // If no listSelector is set yet, set the listSelector if (!listSelector) { setListSelector(highlighterData.selector); notify(`info`, `List selected successfully. Select the text data for extraction.`); @@ -242,10 +230,20 @@ export const BrowserWindow = () => { }; return updatedFields; }); + + if (paginationMode) { + // Only allow selection in pagination mode if type is not empty, 'scrollDown', or 'scrollUp' + if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') { + setPaginationSelector(highlighterData.selector); + notify(`info`, `Pagination element selected successfully.`); + addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); + } + return; + } // Add new field and update the list step if (listSelector) { - addListStep(listSelector, { ...fields, [newField.id]: newField }, currentListId, { type: '', selector: paginationSelector }); + addListStep(listSelector, { ...fields, [newField.id]: newField }, currentListId, { type: paginationType, selector: paginationSelector }); } } else {