This is an automated email from the ASF dual-hosted git repository. diegopucci pushed a commit to branch enxdev/fix/modal-sticky-pagination in repository https://gitbox.apache.org/repos/asf/superset.git
commit 4bae219987b1a5790c9bbeb64f65684a71693227 Author: Diego Pucci <[email protected]> AuthorDate: Thu Jan 15 17:35:51 2026 +0100 fix: Prevent table rows from overlapping pagination in table view --- .../Chart/DrillBy/useResultsTableView.test.ts | 48 ++++++++++++++++++++++ .../Chart/DrillBy/useResultsTableView.tsx | 5 ++- .../components/SingleQueryResultPane.tsx | 5 ++- .../src/explore/components/DataTablesPane/types.ts | 1 + 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.test.ts b/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.test.ts index 3eed3696f5..59a5505a76 100644 --- a/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.test.ts +++ b/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.test.ts @@ -27,6 +27,24 @@ import { } from 'spec/helpers/testing-library'; import { useResultsTableView } from './useResultsTableView'; +const capturedProps: any[] = []; + +jest.mock( + 'src/explore/components/DataTablesPane/components/SingleQueryResultPane', + () => { + const actual = jest.requireActual( + 'src/explore/components/DataTablesPane/components/SingleQueryResultPane', + ); + return { + ...actual, + SingleQueryResultPane: (props: any) => { + capturedProps.push(props); + return actual.SingleQueryResultPane(props); + }, + }; + }, +); + const MOCK_CHART_DATA_RESULT = [ { colnames: ['name', 'sum__num'], @@ -111,3 +129,33 @@ test('Displays results for 2 queries', async () => { within(getActiveTabElement()).getAllByTestId('table-row'), ).toHaveLength(2); }); + +test('passes isPaginationSticky={false} to SingleQueryResultPane for single query', () => { + capturedProps.length = 0; + const { result } = renderHook(() => + useResultsTableView(MOCK_CHART_DATA_RESULT.slice(0, 1), '1__table', true), + ); + render(result.current, { useRedux: true }); + + expect(capturedProps.length).toBeGreaterThan(0); + capturedProps.forEach(props => { + expect(props).toMatchObject({ + isPaginationSticky: false, + }); + }); +}); + +test('passes isPaginationSticky={false} to SingleQueryResultPane for multiple queries', () => { + capturedProps.length = 0; + const { result } = renderHook(() => + useResultsTableView(MOCK_CHART_DATA_RESULT, '1__table', true), + ); + render(result.current, { useRedux: true }); + + expect(capturedProps.length).toBeGreaterThanOrEqual(2); + capturedProps.forEach(props => { + expect(props).toMatchObject({ + isPaginationSticky: false, + }); + }); +}); diff --git a/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.tsx b/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.tsx index da9d99ef91..f64ba36669 100644 --- a/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.tsx +++ b/superset-frontend/src/components/Chart/DrillBy/useResultsTableView.tsx @@ -16,8 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { t } from '@apache-superset/core'; -import { isDefined, QueryData } from '@superset-ui/core'; +import { isDefined, QueryData, t } from '@superset-ui/core'; import { css, styled } from '@apache-superset/core/ui'; import { SingleQueryResultPane } from 'src/explore/components/DataTablesPane/components/SingleQueryResultPane'; import Tabs from '@superset-ui/core/components/Tabs'; @@ -52,6 +51,7 @@ export const useResultsTableView = ( datasourceId={datasourceId} isVisible canDownload={canDownload} + isPaginationSticky={false} /> </PaginationContainer> ); @@ -73,6 +73,7 @@ export const useResultsTableView = ( datasourceId={datasourceId} isVisible canDownload={canDownload} + isPaginationSticky={false} /> </PaginationContainer> ), diff --git a/superset-frontend/src/explore/components/DataTablesPane/components/SingleQueryResultPane.tsx b/superset-frontend/src/explore/components/DataTablesPane/components/SingleQueryResultPane.tsx index 73fa093bec..add3081550 100644 --- a/superset-frontend/src/explore/components/DataTablesPane/components/SingleQueryResultPane.tsx +++ b/superset-frontend/src/explore/components/DataTablesPane/components/SingleQueryResultPane.tsx @@ -17,7 +17,7 @@ * under the License. */ import { useState, useCallback } from 'react'; -import { t } from '@apache-superset/core'; +import { t } from '@superset-ui/core'; import { TableView, TableSize, @@ -39,6 +39,7 @@ export const SingleQueryResultPane = ({ dataSize = 50, isVisible, canDownload, + isPaginationSticky = true, }: SingleQueryResultPaneProp) => { const [filterText, setFilterText] = useState(''); @@ -80,7 +81,7 @@ export const SingleQueryResultPane = ({ noDataText={t('No results')} emptyWrapperType={EmptyWrapperType.Small} className="table-condensed" - isPaginationSticky + isPaginationSticky={isPaginationSticky} showRowCount={false} small /> diff --git a/superset-frontend/src/explore/components/DataTablesPane/types.ts b/superset-frontend/src/explore/components/DataTablesPane/types.ts index 7a4764974b..47616d1bb7 100644 --- a/superset-frontend/src/explore/components/DataTablesPane/types.ts +++ b/superset-frontend/src/explore/components/DataTablesPane/types.ts @@ -88,4 +88,5 @@ export interface SingleQueryResultPaneProp extends QueryResultInterface { // reload OriginalFormattedTimeColumns from localStorage when isVisible is true isVisible: boolean; canDownload: boolean; + isPaginationSticky?: boolean; }
