feat: pass action id to browser steps

This commit is contained in:
Rohit
2025-05-20 17:44:00 +05:30
parent 35c3278933
commit 111bfec00e

View File

@@ -85,7 +85,7 @@ export const BrowserWindow = () => {
const [paginationSelector, setPaginationSelector] = useState<string>(''); const [paginationSelector, setPaginationSelector] = useState<string>('');
const { socket } = useSocketStore(); const { socket } = useSocketStore();
const { notify } = useGlobalInfoStore(); const { notify, currentTextActionId, currentListActionId } = useGlobalInfoStore();
const { getText, getList, paginationMode, paginationType, limitMode, captureStage } = useActionContext(); const { getText, getList, paginationMode, paginationType, limitMode, captureStage } = useActionContext();
const { addTextStep, addListStep, updateListStepData } = useBrowserSteps(); const { addTextStep, addListStep, updateListStepData } = useBrowserSteps();
@@ -326,8 +326,8 @@ export const BrowserWindow = () => {
selector: highlighterData.selector, selector: highlighterData.selector,
tag: highlighterData.elementInfo?.tagName, tag: highlighterData.elementInfo?.tagName,
shadow: highlighterData.elementInfo?.isShadowRoot, shadow: highlighterData.elementInfo?.isShadowRoot,
attribute attribute,
}); }, currentTextActionId || `text-${Date.now()}`);
} else { } else {
// Show the modal if there are multiple options // Show the modal if there are multiple options
setAttributeOptions(options); setAttributeOptions(options);
@@ -344,7 +344,7 @@ export const BrowserWindow = () => {
if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') { if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') {
setPaginationSelector(highlighterData.selector); setPaginationSelector(highlighterData.selector);
notify(`info`, t('browser_window.attribute_modal.notifications.pagination_select_success')); notify(`info`, t('browser_window.attribute_modal.notifications.pagination_select_success'));
addListStep(listSelector!, fields, currentListId || 0, { type: paginationType, selector: highlighterData.selector }); addListStep(listSelector!, fields, currentListId || 0, currentListActionId || `list-${Date.now()}`, { type: paginationType, selector: highlighterData.selector });
socket?.emit('setPaginationMode', { pagination: false }); socket?.emit('setPaginationMode', { pagination: false });
} }
return; return;
@@ -412,6 +412,7 @@ export const BrowserWindow = () => {
listSelector, listSelector,
updatedFields, updatedFields,
currentListId, currentListId,
currentListActionId || `list-${Date.now()}`,
{ type: '', selector: paginationSelector } { type: '', selector: paginationSelector }
); );
} }
@@ -449,7 +450,7 @@ export const BrowserWindow = () => {
tag: selectedElement.info?.tagName, tag: selectedElement.info?.tagName,
shadow: selectedElement.info?.isShadowRoot, shadow: selectedElement.info?.isShadowRoot,
attribute: attribute attribute: attribute
}); }, currentTextActionId || `text-${Date.now()}`);
} }
if (getList === true && listSelector && currentListId) { if (getList === true && listSelector && currentListId) {
const newField: TextStep = { const newField: TextStep = {
@@ -484,6 +485,7 @@ export const BrowserWindow = () => {
listSelector, listSelector,
updatedFields, updatedFields,
currentListId, currentListId,
currentListActionId || `list-${Date.now()}`,
{ type: '', selector: paginationSelector } { type: '', selector: paginationSelector }
); );
} }