feat: pass session storage cleanup message

This commit is contained in:
Rohit
2025-04-09 20:49:01 +05:30
parent b95d30cda9
commit 18924d89df
2 changed files with 7 additions and 5 deletions

View File

@@ -55,6 +55,11 @@ const BrowserRecordingSave = () => {
type: 'recording-notification', type: 'recording-notification',
notification: notificationData notification: notificationData
}, '*'); }, '*');
window.opener.postMessage({
type: 'session-data-clear',
timestamp: Date.now()
}, '*');
} }
setBrowserId(null); setBrowserId(null);

View File

@@ -322,7 +322,6 @@ export const RecordingsTable = ({
let targetUrl; let targetUrl;
if (robot?.content?.workflow && robot.content.workflow.length > 0) { if (robot?.content?.workflow && robot.content.workflow.length > 0) {
// Get the last workflow item
const lastPair = robot.content.workflow[robot.content.workflow.length - 1]; const lastPair = robot.content.workflow[robot.content.workflow.length - 1];
if (lastPair?.what) { if (lastPair?.what) {
@@ -338,7 +337,6 @@ export const RecordingsTable = ({
} }
} }
// Set the URL in state and session storage
if (targetUrl) { if (targetUrl) {
setInitialUrl(targetUrl); setInitialUrl(targetUrl);
setRecordingUrl(targetUrl); setRecordingUrl(targetUrl);
@@ -349,15 +347,14 @@ export const RecordingsTable = ({
setActiveBrowserId(activeBrowserId); setActiveBrowserId(activeBrowserId);
setWarningModalOpen(true); setWarningModalOpen(true);
} else { } else {
// Pass the URL directly to avoid timing issues with state updates
startRetrainRecording(id, name, targetUrl); startRetrainRecording(id, name, targetUrl);
} }
}, [rows, setInitialUrl, setRecordingUrl]); }, [rows, setInitialUrl, setRecordingUrl]);
const startRetrainRecording = (id: string, name: string, url?: string) => { const startRetrainRecording = (id: string, name: string, url?: string) => {
setBrowserId('new-recording'); setBrowserId('new-recording');
setRecordingName(''); setRecordingName(name);
setRecordingId(''); setRecordingId(id);
window.sessionStorage.setItem('browserId', 'new-recording'); window.sessionStorage.setItem('browserId', 'new-recording');
window.sessionStorage.setItem('robotToRetrain', id); window.sessionStorage.setItem('robotToRetrain', id);