feat: wrap in useEffect
This commit is contained in:
@@ -271,14 +271,22 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
onFinishCapture();
|
onFinishCapture();
|
||||||
}, [stopGetList, getListSettingsObject, socket, notify, handleStopGetList]);
|
}, [stopGetList, getListSettingsObject, socket, notify, handleStopGetList]);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (captureStage === 'initial') {
|
||||||
|
const hasUnconfirmedListTextFields = browserSteps.some(step =>
|
||||||
|
step.type === 'list' && Object.values(step.fields).some(field => !confirmedListTextFields[step.id]?.[field.id])
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasUnconfirmedListTextFields) {
|
||||||
|
notify('error', 'Please confirm all field labels.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [captureStage, confirmedListTextFields, browserSteps, notify]);
|
||||||
|
|
||||||
const handleConfirmListCapture = useCallback(() => {
|
const handleConfirmListCapture = useCallback(() => {
|
||||||
switch (captureStage) {
|
switch (captureStage) {
|
||||||
case 'initial':
|
case 'initial':
|
||||||
const hasUnconfirmedListTextFields = browserSteps.some(step => step.type === 'list' && Object.values(step.fields).some(field => !confirmedListTextFields[step.id]?.[field.id]));
|
|
||||||
if (hasUnconfirmedListTextFields) {
|
|
||||||
notify('error', 'Please confirm all field labels.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startPaginationMode();
|
startPaginationMode();
|
||||||
setShowPaginationOptions(true);
|
setShowPaginationOptions(true);
|
||||||
setCaptureStage('pagination');
|
setCaptureStage('pagination');
|
||||||
@@ -322,7 +330,20 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
|
|||||||
setCaptureStage('initial');
|
setCaptureStage('initial');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}, [captureStage, paginationType, limitType, customLimit, startPaginationMode, stopPaginationMode, startLimitMode, stopLimitMode, notify, stopCaptureAndEmitGetListSettings, getListSettingsObject]);
|
}, [
|
||||||
|
captureStage,
|
||||||
|
paginationType,
|
||||||
|
limitType,
|
||||||
|
customLimit,
|
||||||
|
startPaginationMode,
|
||||||
|
stopPaginationMode,
|
||||||
|
startLimitMode,
|
||||||
|
stopLimitMode,
|
||||||
|
notify,
|
||||||
|
stopCaptureAndEmitGetListSettings,
|
||||||
|
getListSettingsObject
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
const handlePaginationSettingSelect = (option: PaginationType) => {
|
const handlePaginationSettingSelect = (option: PaginationType) => {
|
||||||
updatePaginationType(option);
|
updatePaginationType(option);
|
||||||
|
|||||||
Reference in New Issue
Block a user