Skip to content

Commit 63397a0

Browse files
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
1 parent 10669d6 commit 63397a0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

docs/en_US/release_notes_9_12.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ Housekeeping
2626

2727
Bug fixes
2828
*********
29+
| `Issue #9380 <https://github.com/pgadmin-org/pgadmin4/issues/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.
30+
2931

web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,8 @@ QuerySourceIcon.propTypes = {
272272
};
273273

274274
function HistoryEntry({entry, formatEntryDate, itemKey, selectedItemKey, onClick}) {
275-
return <ListItemButton component='li' tabIndex="0" data-label="history-entry" data-pgadmin={entry.is_pgadmin_query} ref={(ele)=>{
276-
selectedItemKey==itemKey && ele?.scrollIntoView({
277-
block: 'center',
278-
behavior: 'smooth',
279-
});
280-
}} className={'QuerySources-fontSourceCode ' + (entry.status ? '' : 'QuerySources-itemError')} selected={selectedItemKey==itemKey} onClick={onClick}>
275+
return <ListItemButton component='li' tabIndex="0" data-label="history-entry" data-pgadmin={entry.is_pgadmin_query}
276+
className={'QuerySources-fontSourceCode ' + (entry.status ? '' : 'QuerySources-itemError')} selected={selectedItemKey==itemKey} onClick={onClick}>
281277
<Box whiteSpace="nowrap" textOverflow="ellipsis" overflow="hidden" >
282278
<QuerySourceIcon source={entry.query_source}/>
283279
{entry.query}
@@ -397,6 +393,10 @@ export function QueryHistory() {
397393
setActiveOnce(true);
398394
setSelectedItemKey((prev)=>prev || 1);
399395
}
396+
397+
listRef.current?.querySelector('[data-label="history-entry"].Mui-selected')?.scrollIntoView({
398+
block: 'center',
399+
});
400400
}
401401
});
402402

0 commit comments

Comments
 (0)