From e90fc466b4cda251e9e5235ca047b5626e8823eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linhart=20Luk=C3=A1=C5=A1?= Date: Fri, 13 Oct 2023 17:27:17 +0200 Subject: [PATCH] Dont reset timer when switch tabs --- .../bruno-app/src/components/ResponsePane/Overlay/index.js | 2 +- packages/bruno-app/src/components/StopWatch/index.js | 6 +++++- packages/bruno-electron/src/ipc/network/index.js | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/components/ResponsePane/Overlay/index.js b/packages/bruno-app/src/components/ResponsePane/Overlay/index.js index e5f659862..247c341ed 100644 --- a/packages/bruno-app/src/components/ResponsePane/Overlay/index.js +++ b/packages/bruno-app/src/components/ResponsePane/Overlay/index.js @@ -17,7 +17,7 @@ const ResponseLoadingOverlay = ({ item, collection }) => {
- +
diff --git a/packages/bruno-app/src/components/StopWatch/index.js b/packages/bruno-app/src/components/StopWatch/index.js index 49bd8c175..e2b069532 100644 --- a/packages/bruno-app/src/components/StopWatch/index.js +++ b/packages/bruno-app/src/components/StopWatch/index.js @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; -const StopWatch = () => { +const StopWatch = ({ requestTimestamp }) => { const [milliseconds, setMilliseconds] = useState(0); const tickInterval = 200; @@ -15,6 +15,10 @@ const StopWatch = () => { }; }); + useEffect(() => { + setMilliseconds(Date.now() - requestTimestamp); + }, [requestTimestamp]); + if (milliseconds < 1000) { return 'Loading...'; } diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index 1def8d964..8e8cb6247 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -195,7 +195,8 @@ const registerNetworkIpc = (mainWindow) => { url: request.url, method: request.method, headers: request.headers, - data: safeParseJSON(safeStringifyJSON(request.data)) + data: safeParseJSON(safeStringifyJSON(request.data)), + timestamp: Date.now() }, collectionUid, itemUid: item.uid,