diff --git a/src/api/storage.ts b/src/api/storage.ts index 054aeee8..2ff1e82a 100644 --- a/src/api/storage.ts +++ b/src/api/storage.ts @@ -60,13 +60,13 @@ export const deleteRunFromStorage = async (id: string): Promise => { } }; -export const editRecordingFromStorage = async (browserId: string, robotId: string): Promise => { +export const editRecordingFromStorage = async (browserId: string, id: string): Promise => { try { - const response = await axios.put(`http://localhost:8080/workflow/${browserId}/${robotId}`); + const response = await axios.put(`http://localhost:8080/workflow/${browserId}/${id}`); if (response.status === 200) { return response.data; } else { - throw new Error(`Couldn't edit stored recording ${robotId}`); + throw new Error(`Couldn't edit stored recording ${id}`); } } catch(error: any) { console.log(error); diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx index adb0a1f3..34d6811d 100644 --- a/src/pages/MainPage.tsx +++ b/src/pages/MainPage.tsx @@ -42,7 +42,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => { let aborted = false; - const { notify, setRerenderRuns } = useGlobalInfoStore(); + const { notify, setRerenderRuns, setRecordingId } = useGlobalInfoStore(); const abortRunHandler = (runId: string) => { aborted = true; @@ -58,6 +58,7 @@ export const MainPage = ({ handleEditRecording }: MainPageProps) => { const setRecordingInfo = (id: string, name: string) => { setRunningRecordingId(id); + setRecordingId(id); setRunningRecordingName(name); } diff --git a/src/pages/RecordingPage.tsx b/src/pages/RecordingPage.tsx index 8683e691..19d94c20 100644 --- a/src/pages/RecordingPage.tsx +++ b/src/pages/RecordingPage.tsx @@ -39,7 +39,7 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => { const { setId, socket } = useSocketStore(); const { setWidth } = useBrowserDimensionsStore(); - const { browserId, setBrowserId } = useGlobalInfoStore(); + const { browserId, setBrowserId, recordingId } = useGlobalInfoStore(); const handleShowOutputData = useCallback(() => { setShowOutputData(true); @@ -93,15 +93,15 @@ export const RecordingPage = ({ recordingName }: RecordingPageProps) => { }, [socket]); const handleLoaded = useCallback(() => { - if (recordingName && browserId) { - editRecordingFromStorage(browserId, recordingName).then(() => setIsLoaded(true)); + if (recordingName && browserId && recordingId) { + editRecordingFromStorage(browserId, recordingId).then(() => setIsLoaded(true)); } else { if (browserId === 'new-recording') { socket?.emit('new-recording'); } setIsLoaded(true); } - }, [socket, browserId, recordingName, isLoaded]) + }, [socket, browserId, recordingName, recordingId, isLoaded]) useEffect(() => { socket?.on('loaded', handleLoaded);