Repository navigation
Description
Detail Bug Report
Introduced in #25353 by @mohityadav766 on Apr 6, 2026
Summary
- Context:
LineageTable.tsxpowers the Impact Analysis tab — a paginated table of upstream/downstream lineage nodes/edges that the user can filter via a free-text search box and a set of "quick filters" (service, owner, tags, glossary, ...). - Bug: When the user types in the search box or changes a quick filter while sitting on a page other than page 1, the table does NOT reset the current page to 1 before refetching. The next call to the lineage API uses
from = (currentPage - 1) * pageSize, which can be far beyond the now‑narrower result set. - Actual vs. expected: The fetched
fromindex is preserved across filter/search changes, so the user is shown an empty table whenever the filtered result set has fewer items than(currentPage - 1) * pageSize. Expected: any change to the user's filters/search should re-fetch starting from page 1 of the new result set. - Impact: While the filter is applied, an empty
NoDataPlaceholderis rendered with no pager at the component default page size, even though matching assets exist on page 1 of the filtered set.
Code with Bug
openmetadata-ui/src/main/resources/ui/src/components/LineageTable/LineageTable.tsx
<CustomControlsComponent
...
searchValue={searchValue}
onSearchValueChange={setSearchValue} // <-- BUG 🔴 no page reset on search change
/>const res = await getLineageByEntityCount({
...
from: (currentPage - 1) * pageSize, // <-- BUG 🔴 stale currentPage survives filter/search changes
size: pageSize,
...
});Column-level mode has the same issue via in-memory slicing:
const source = nodes.slice(
(currentPage - 1) * pageSize, // <-- BUG 🔴 stale currentPage slices past narrowed node list
currentPage * pageSize
);Explanation
- Pagination is reset to page 1 for impact-level changes and upstream/downstream direction changes, but not for search or quick-filter changes.
CustomControlsComponent(which owns the search box and quick filters) is not wired tohandlePageChange(1); it only updates filter state (setSearchValue,setSelectedQuickFilters).usePagingdoes not auto-resetcurrentPagewhenpaging.totalshrinks.- Result: on page ≥ 2, narrowing the dataset can make
(currentPage - 1) * pageSizeexceed the filtered result count.- Table-level mode: the stale
fromis sent togetLineageByEntityCount, and the backend returns a page containing only the root; the UI deletes the root node and ends up rendering an empty table. - Column-level mode: the full filtered list is fetched, but the UI slices using the stale
currentPage, producing[].
- Table-level mode: the stale
- At the component’s default
pageSize=50,usePagingcan setshowPagination=falsewhenpaging.total < 50, andTableV2then renders no pagination footer, leaving no in-component way to “stay filtered and go to page 1.”
Codebase Inconsistency
Impact-level and direction changes explicitly reset the page, but search/quick-filter changes do not:
onAction={(key: Key) => {
flushSync(() => {
setSelectedImpactLevel(key as EImpactLevel);
});
clearQuickFilterValues();
handlePageChange(1); // <-- resets here
}}onSelectionChange={(keys: Selection) => {
const value = [...(keys as Set<LineageDirection>)][0];
if (value) {
handlePageChange(1); // <-- resets here
updateURLParams({ dir: value });
}
}}Failing Test
A Jest repro (using real usePaging) demonstrates the bug by showing from is not reset when searchValue changes while seeded to currentPage=3&pageSize=10:
it('▶ STALE-OFFSET REPRO: real usePaging keeps currentPage across a search change (seeded URL currentPage=3)', async () => {
const realUsePaging =
(jest.requireActual('../../hooks/paging/usePaging') as {
usePaging: typeof usePaging;
}).usePaging;
mockUsePaging.mockImplementation(realUsePaging);
(
getSearchNameEsQuery as jest.MockedFunction<typeof getSearchNameEsQuery>
).mockImplementation((searchText: string) => ({
bool: {
should: [
{ wildcard: { 'name.keyword': { value: `*${searchText}*` } } },
{ wildcard: { 'displayName.keyword': { value: `*${searchText}*` } } },
],
},
}));
mockUseLineageTableState.mockReturnValue({
...defaultMockState,
impactLevel: EImpactLevel.TableLevel,
searchValue: '',
setFilterNodes: jest.fn(),
});
const { rerender } = render(<LineageTable entity={mockEntity} />, {
wrapper: ({ children }) => (
<MemoryRouter initialEntries={['/test?currentPage=3&pageSize=10']}>
{children}
</MemoryRouter>
),
});
await waitFor(() => {
expect(mockGetLineageByEntityCount).toHaveBeenCalledWith(
expect.objectContaining({ from: 20, size: 10 })
);
});
mockGetLineageByEntityCount.mockClear();
mockUseLineageTableState.mockReturnValue({
...defaultMockState,
impactLevel: EImpactLevel.TableLevel,
searchValue: 'narrow',
setFilterNodes: jest.fn(),
});
rerender(<LineageTable entity={mockEntity} />);
await waitFor(() => {
expect(mockGetLineageByEntityCount).toHaveBeenCalledWith(
expect.objectContaining({ from: 20, size: 10 })
);
});
expect(
JSON.stringify(mockGetLineageByEntityCount.mock.calls[0][0].query_filter ?? '')
).toContain('narrow');
});Test output:
PASS @openmetadata src/components/LineageTable/LineageTable.test.tsx (8.401 s)
fetchNodes - Table Level Impact
✓ ▶ STALE-OFFSET REPRO: real usePaging keeps currentPage across a search change (seeded URL currentPage=3) (62 ms)
Tests: 37 passed, 37 total
Recommended Fix
Reset to page 1 in the same handler that updates search/quick-filter state (not a separate useEffect). Example for search:
const handleSearchValueChange = useCallback(
(value: string) => {
handlePageChange(1);
setSearchValue(value);
},
[handlePageChange, setSearchValue]
);Apply the same pattern for quick-filter changes/clears so both table-level and column-level modes reset currentPage before the next fetch/slice.
History
This bug was introduced in commit 7bb8e40. The change ("Fix column filtering on Lineage", #25353) rewired the Impact Analysis search box to always call setSearchValue (expanding search to column-level) without adding a page reset, so filtering/searching on page ≥ 2 now uses a stale offset.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone ✅
Activity
test(ui): add Playwright pagination-reset tests for Impact Analysis (#…
Fixes open-metadata#32632: reset Impact Analysis pagination to page 1…
Backport to 2.0: #32736 #32699 #33115 #32741 (#33211)