From 7c61017f578cf91368e25dabc2894e2682980b76 Mon Sep 17 00:00:00 2001 From: Pradip Parkale Date: Thu, 28 Apr 2022 12:10:42 +0530 Subject: [PATCH] Fixed an issue where the Dashboard Server Activity was showing old queries as active. Fixes #7305 --- docs/en_US/release_notes_6_9.rst | 1 + web/pgadmin/dashboard/static/js/Dashboard.jsx | 22 +++++++++---------- web/pgadmin/static/js/components/PgTable.jsx | 4 ++-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/docs/en_US/release_notes_6_9.rst b/docs/en_US/release_notes_6_9.rst index 2958d67f1..6bf206b66 100644 --- a/docs/en_US/release_notes_6_9.rst +++ b/docs/en_US/release_notes_6_9.rst @@ -40,6 +40,7 @@ Bug fixes | `Issue #7294 `_ - Fixed an issue where the copy and paste row does not work if the first column contains no data. | `Issue #7296 `_ - Ensure that after deleting multiple objects from the properties panel, the browser tree should be refreshed. | `Issue #7299 `_ - Fixed sorting issue in the statistics panel. + | `Issue #7305 `_ - Fixed an issue where the Dashboard Server Activity was showing old queries as active. | `Issue #7307 `_ - Fixed an issue where the table showed duplicate columns when creating multiple sequences on the same column. | `Issue #7308 `_ - Ensure that sorting should be preserved on refresh for Server Activity. | `Issue #7322 `_ - Fixed an issue while creating a new database throwing an error that failed to retrieve data. diff --git a/web/pgadmin/dashboard/static/js/Dashboard.jsx b/web/pgadmin/dashboard/static/js/Dashboard.jsx index ebf4c082b..384c6ce91 100644 --- a/web/pgadmin/dashboard/static/js/Dashboard.jsx +++ b/web/pgadmin/dashboard/static/js/Dashboard.jsx @@ -353,18 +353,16 @@ export default function Dashboard({ onClick={(e) => { e.preventDefault(); row.toggleRowExpanded(!row.isExpanded); - if(!(row.id in schemaDict)){ - let schema = new ActiveQuery({ - query: row.original.query, - backend_type: row.original.backend_type, - state_change: row.original.state_change, - query_start: row.original.query_start, - }); - setSchemaDict(prevState => ({ - ...prevState, - [row.id]: schema - })); - } + let schema = new ActiveQuery({ + query: row.original.query, + backend_type: row.original.backend_type, + state_change: row.original.state_change, + query_start: row.original.query_start, + }); + setSchemaDict(prevState => ({ + ...prevState, + [row.id]: schema + })); }} disabled={!canEditRow} aria-label="View the active session details" diff --git a/web/pgadmin/static/js/components/PgTable.jsx b/web/pgadmin/static/js/components/PgTable.jsx index b3e99f740..c2d23e0df 100644 --- a/web/pgadmin/static/js/components/PgTable.jsx +++ b/web/pgadmin/static/js/components/PgTable.jsx @@ -228,12 +228,12 @@ export default function PgTable({ columns, data, isSelectRow, caveTable=true, .. const tableRef = React.useRef(); const rowHeights = React.useRef({}); - // Reset Search vakue in tab changed. + // Reset Search value on tab changes. React.useEffect(()=>{ setSearchVal(''); rowHeights.current = {}; tableRef.current?.resetAfterIndex(0); - }, [columns]); + }, [data]); function getRowHeight(index) { return rowHeights.current[index] || ROW_HEIGHT;