From 0d71cd7d100a44063b11e8fba2a24e0ba9edeb79 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sun, 1 Sep 2024 01:13:29 +0530 Subject: [PATCH] feat: handle pagination selection before emitting getList settings --- src/components/organisms/RightSidePanel.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 5cdbb5f4..b56544da 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -140,11 +140,16 @@ export const RightSidePanel = () => { setShowPaginationOptions(true); return; } - // Proceed to stop capture and emit settings only after pagination type is selected + if (['clickNext', 'clickLoadMore'].includes(selectedPaginationSetting) && !paginationSelector) { + notify('error', 'Please select the pagination element first.'); + return; + } stopCaptureAndEmitGetListSettings(); setShowPaginationOptions(false); + setShowPaginationSelector(false); setSelectedPaginationSetting(null); - }, [selectedPaginationSetting, stopCaptureAndEmitGetListSettings]); + setPaginationSelector(null); + }, [selectedPaginationSetting, paginationSelector, stopCaptureAndEmitGetListSettings, notify]); const handlePaginationSettingSelect = (option: string) => { setSelectedPaginationSetting(option);