diff --git a/src/components/browser/BrowserWindow.tsx b/src/components/browser/BrowserWindow.tsx index f078d61c..8ce6e0f9 100644 --- a/src/components/browser/BrowserWindow.tsx +++ b/src/components/browser/BrowserWindow.tsx @@ -327,7 +327,7 @@ export const BrowserWindow = () => { tag: highlighterData.elementInfo?.tagName, shadow: highlighterData.elementInfo?.isShadowRoot, attribute, - }, currentTextActionId || `text-${Date.now()}`); + }, currentTextActionId || `text-${crypto.randomUUID()}`); } else { // Show the modal if there are multiple options setAttributeOptions(options); @@ -344,7 +344,7 @@ export const BrowserWindow = () => { if (paginationType !== '' && paginationType !== 'scrollDown' && paginationType !== 'scrollUp' && paginationType !== 'none') { setPaginationSelector(highlighterData.selector); 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 }); } return; @@ -412,7 +412,7 @@ export const BrowserWindow = () => { listSelector, updatedFields, currentListId, - currentListActionId || `list-${Date.now()}`, + currentListActionId || `list-${crypto.randomUUID()}`, { type: '', selector: paginationSelector } ); } @@ -450,7 +450,7 @@ export const BrowserWindow = () => { tag: selectedElement.info?.tagName, shadow: selectedElement.info?.isShadowRoot, attribute: attribute - }, currentTextActionId || `text-${Date.now()}`); + }, currentTextActionId || `text-${crypto.randomUUID()}`); } if (getList === true && listSelector && currentListId) { const newField: TextStep = { @@ -485,7 +485,7 @@ export const BrowserWindow = () => { listSelector, updatedFields, currentListId, - currentListActionId || `list-${Date.now()}`, + currentListActionId || `list-${crypto.randomUUID()}`, { type: '', selector: paginationSelector } ); } diff --git a/src/components/recorder/RightSidePanel.tsx b/src/components/recorder/RightSidePanel.tsx index e29e9d2a..8d8cac22 100644 --- a/src/components/recorder/RightSidePanel.tsx +++ b/src/components/recorder/RightSidePanel.tsx @@ -139,20 +139,20 @@ export const RightSidePanel: React.FC = ({ onFinishCapture const handleStartGetText = () => { setIsCaptureTextConfirmed(false); - const newActionId = `text-${Date.now()}`; + const newActionId = `text-${crypto.randomUUID()}`; setCurrentTextActionId(newActionId); startGetText(); } const handleStartGetList = () => { setIsCaptureListConfirmed(false); - const newActionId = `list-${Date.now()}`; + const newActionId = `list-${crypto.randomUUID()}`; setCurrentListActionId(newActionId); startGetList(); } const handleStartGetScreenshot = () => { - const newActionId = `screenshot-${Date.now()}`; + const newActionId = `screenshot-${crypto.randomUUID()}`; setCurrentScreenshotActionId(newActionId); startGetScreenshot(); };