From 63397a003ab1c8b39815922cec1310d7c83a54dd Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Fri, 12 Dec 2025 11:27:39 +0530 Subject: [PATCH] Fixed an issue where the Query History panel would auto-scroll to the top and did not preserve the scroll bar position for the selected entry. #9380 --- docs/en_US/release_notes_9_12.rst | 2 ++ .../static/js/components/sections/QueryHistory.jsx | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/en_US/release_notes_9_12.rst b/docs/en_US/release_notes_9_12.rst index 4e05c733b..7eb505061 100644 --- a/docs/en_US/release_notes_9_12.rst +++ b/docs/en_US/release_notes_9_12.rst @@ -26,4 +26,6 @@ Housekeeping Bug fixes ********* +| `Issue #9380 `_ - Fixed an issue where the Query History panel would auto-scroll to the top and did not preserve the scroll bar position for the selected entry. + diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx index 1f48181dc..3abc8eded 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx @@ -272,12 +272,8 @@ QuerySourceIcon.propTypes = { }; function HistoryEntry({entry, formatEntryDate, itemKey, selectedItemKey, onClick}) { - return { - selectedItemKey==itemKey && ele?.scrollIntoView({ - block: 'center', - behavior: 'smooth', - }); - }} className={'QuerySources-fontSourceCode ' + (entry.status ? '' : 'QuerySources-itemError')} selected={selectedItemKey==itemKey} onClick={onClick}> + return {entry.query} @@ -397,6 +393,10 @@ export function QueryHistory() { setActiveOnce(true); setSelectedItemKey((prev)=>prev || 1); } + + listRef.current?.querySelector('[data-label="history-entry"].Mui-selected')?.scrollIntoView({ + block: 'center', + }); } });