Merge pull request #609 from RohitR311/single-discard

feat: generate truly unique action ids
This commit is contained in:
Karishma Shukla
2025-05-26 21:45:04 +05:30
committed by GitHub
2 changed files with 8 additions and 8 deletions

View File

@@ -327,7 +327,7 @@ export const BrowserWindow = () => {
tag: highlighterData.elementInfo?.tagName, tag: highlighterData.elementInfo?.tagName,
shadow: highlighterData.elementInfo?.isShadowRoot, shadow: highlighterData.elementInfo?.isShadowRoot,
attribute, attribute,
}, currentTextActionId || `text-${Date.now()}`); }, currentTextActionId || `text-${crypto.randomUUID()}`);
} 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, currentListActionId || `list-${Date.now()}`, { type: paginationType, selector: highlighterData.selector }); addListStep(listSelector!, fields, currentListId || 0, currentListActionId || `list-${crypto.randomUUID()}`, { type: paginationType, selector: highlighterData.selector });
socket?.emit('setPaginationMode', { pagination: false }); socket?.emit('setPaginationMode', { pagination: false });
} }
return; return;
@@ -412,7 +412,7 @@ export const BrowserWindow = () => {
listSelector, listSelector,
updatedFields, updatedFields,
currentListId, currentListId,
currentListActionId || `list-${Date.now()}`, currentListActionId || `list-${crypto.randomUUID()}`,
{ type: '', selector: paginationSelector } { type: '', selector: paginationSelector }
); );
} }
@@ -450,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()}`); }, currentTextActionId || `text-${crypto.randomUUID()}`);
} }
if (getList === true && listSelector && currentListId) { if (getList === true && listSelector && currentListId) {
const newField: TextStep = { const newField: TextStep = {
@@ -485,7 +485,7 @@ export const BrowserWindow = () => {
listSelector, listSelector,
updatedFields, updatedFields,
currentListId, currentListId,
currentListActionId || `list-${Date.now()}`, currentListActionId || `list-${crypto.randomUUID()}`,
{ type: '', selector: paginationSelector } { type: '', selector: paginationSelector }
); );
} }

View File

@@ -139,20 +139,20 @@ export const RightSidePanel: React.FC<RightSidePanelProps> = ({ onFinishCapture
const handleStartGetText = () => { const handleStartGetText = () => {
setIsCaptureTextConfirmed(false); setIsCaptureTextConfirmed(false);
const newActionId = `text-${Date.now()}`; const newActionId = `text-${crypto.randomUUID()}`;
setCurrentTextActionId(newActionId); setCurrentTextActionId(newActionId);
startGetText(); startGetText();
} }
const handleStartGetList = () => { const handleStartGetList = () => {
setIsCaptureListConfirmed(false); setIsCaptureListConfirmed(false);
const newActionId = `list-${Date.now()}`; const newActionId = `list-${crypto.randomUUID()}`;
setCurrentListActionId(newActionId); setCurrentListActionId(newActionId);
startGetList(); startGetList();
} }
const handleStartGetScreenshot = () => { const handleStartGetScreenshot = () => {
const newActionId = `screenshot-${Date.now()}`; const newActionId = `screenshot-${crypto.randomUUID()}`;
setCurrentScreenshotActionId(newActionId); setCurrentScreenshotActionId(newActionId);
startGetScreenshot(); startGetScreenshot();
}; };