Skip to content

Commit

Permalink
Optimize scrolling behavior of Discover table
Browse files Browse the repository at this point in the history
This is an improvement to opensearch-project#6683

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Jun 13, 2024
1 parent e74ed2c commit b5ec877
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ const DefaultDiscoverTableUI = ({
if (tableElement) {
// Load the first batch of rows and adjust the columns to the contents
tableElement.style.tableLayout = 'auto';
// To prevent influencing the auto-sizing, unset the widths from a previous render
tableElement
.querySelectorAll('thead > tr > th:not(:first-child):not(:last-child)')
.forEach((th) => {
(th as HTMLTableCellElement).style.width = 'unset';
});

tableLayoutRequestFrameRef.current = requestAnimationFrame(() => {
if (tableElement) {
Expand Down

0 comments on commit b5ec877

Please sign in to comment.