Repository navigation
fix(app): keep search and pattern tiles on screen while a dashboard refreshes #3224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Harshul1484
wants to merge
4
commits into
ClickHouse:main
Choose a base branch
from
Harshul1484:fix/search-patterns-tile-refresh-pulse
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9871679
fix(app): keep search tile rows on screen while a dashboard refreshes
Harshul1484 bb922e4
fix(app): keep pattern tiles on screen while a dashboard refreshes
Harshul1484 f16d03d
fix(app): keep pattern groups stable and hide the loading footer whil…
Harshul1484 eb8f771
fix(app): drop the redundant keepPreviousData check in the pattern table
Harshul1484 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| fix: keep pattern tiles on screen while a dashboard refreshes | ||
|
|
||
| During a refresh, event pattern tiles dropped their patterns and showed a | ||
| loading state until the new sample was mined. They now keep the current | ||
| patterns on screen and pulse while the refetch runs, like the other dashboard | ||
| tiles. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| fix: keep search tile rows on screen while a dashboard refreshes | ||
|
|
||
| During a refresh, search tiles dropped their rows and showed a loading state | ||
| until the new results arrived. They now keep the current rows on screen and | ||
| pulse while the refetch runs, like the other dashboard tiles. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
packages/app/src/components/__tests__/DBSqlRowTable.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
| import { screen } from '@testing-library/react'; | ||
|
|
||
| import { DBSqlRowTable } from '@/components/DBRowTable'; | ||
|
|
||
| const mockUseOffsetPaginatedQuery = jest.fn(); | ||
| jest.mock('@/hooks/useOffsetPaginatedQuery', () => ({ | ||
| __esModule: true, | ||
| default: (...args: unknown[]) => mockUseOffsetPaginatedQuery(...args), | ||
| })); | ||
|
|
||
| jest.mock('@/api', () => ({ | ||
| __esModule: true, | ||
| default: { useMe: () => ({ data: { team: {} } }) }, | ||
| })); | ||
|
|
||
| jest.mock('@/hooks/useMetadata', () => ({ | ||
| ...jest.requireActual('@/hooks/useMetadata'), | ||
| useColumns: () => ({ data: undefined }), | ||
| useTableMetadata: () => ({ | ||
| data: { primary_key: 'Timestamp', partition_key: 'toDate(Timestamp)' }, | ||
| }), | ||
| })); | ||
|
|
||
| jest.mock('@/hooks/usePatterns', () => ({ | ||
| ...jest.requireActual('@/hooks/usePatterns'), | ||
| useGroupedPatterns: () => ({ data: {}, isLoading: false, miner: null }), | ||
| })); | ||
|
|
||
| jest.mock('@/source', () => ({ | ||
| ...jest.requireActual('@/source'), | ||
| useSource: () => ({ data: undefined }), | ||
| })); | ||
|
|
||
| jest.mock('@/hooks/useChartConfig', () => ({ | ||
| ...jest.requireActual('@/hooks/useChartConfig'), | ||
| useAliasMapFromChartConfig: () => ({ data: {}, isLoading: false }), | ||
| useRenderedSqlChartConfig: () => ({ data: '', isLoading: false }), | ||
| })); | ||
|
|
||
| const config: React.ComponentProps<typeof DBSqlRowTable>['config'] = { | ||
| select: 'Body', | ||
| from: { databaseName: 'default', tableName: 'otel_logs' }, | ||
| where: '', | ||
| timestampValueExpression: 'Timestamp', | ||
| connection: 'test-connection', | ||
| dateRange: [ | ||
| new Date('2026-07-06T00:00:00Z'), | ||
| new Date('2026-07-06T01:00:00Z'), | ||
| ], | ||
| }; | ||
|
|
||
| function mockQueryResult({ | ||
| isPlaceholderData, | ||
| }: { | ||
| isPlaceholderData: boolean; | ||
| }) { | ||
| mockUseOffsetPaginatedQuery.mockReturnValue({ | ||
| data: { | ||
| data: [{ Body: 'previous row' }], | ||
| meta: [{ name: 'Body', type: 'String' }], | ||
| window: undefined, | ||
| }, | ||
| fetchNextPage: jest.fn(), | ||
| hasNextPage: false, | ||
| isFetching: isPlaceholderData, | ||
| isError: false, | ||
| error: null, | ||
| isPlaceholderData, | ||
| }); | ||
| } | ||
|
|
||
| function renderTable( | ||
| props: Partial<React.ComponentProps<typeof DBSqlRowTable>>, | ||
| ) { | ||
| return renderWithMantine( | ||
| <QueryClientProvider client={new QueryClient()}> | ||
| <DBSqlRowTable config={config} sourceId="source-id" {...props} /> | ||
| </QueryClientProvider>, | ||
| ); | ||
| } | ||
|
|
||
| describe('DBSqlRowTable refresh', () => { | ||
| beforeEach(() => { | ||
| mockUseOffsetPaginatedQuery.mockReset(); | ||
| }); | ||
|
|
||
| it('asks the query to keep the previous rows when keepPreviousData is set', () => { | ||
| mockQueryResult({ isPlaceholderData: false }); | ||
|
|
||
| renderTable({ keepPreviousData: true }); | ||
|
|
||
| expect(mockUseOffsetPaginatedQuery.mock.calls[0][1]).toEqual( | ||
| expect.objectContaining({ keepPreviousData: true }), | ||
| ); | ||
| }); | ||
|
|
||
| it('pulses the previous rows while a refresh loads', () => { | ||
| mockQueryResult({ isPlaceholderData: true }); | ||
|
|
||
| renderTable({ keepPreviousData: true }); | ||
|
|
||
| expect(screen.getByTestId('search-results-table')).toHaveClass( | ||
| 'effect-pulse', | ||
| ); | ||
| }); | ||
|
|
||
| it('does not pulse once fresh rows have loaded', () => { | ||
| mockQueryResult({ isPlaceholderData: false }); | ||
|
|
||
| renderTable({ keepPreviousData: true }); | ||
|
|
||
| expect(screen.getByTestId('search-results-table')).not.toHaveClass( | ||
| 'effect-pulse', | ||
| ); | ||
| }); | ||
|
|
||
| it('does not pulse without keepPreviousData (e.g. live tail on the search page)', () => { | ||
| mockQueryResult({ isPlaceholderData: true }); | ||
|
|
||
| renderTable({ isLive: true }); | ||
|
|
||
| expect(screen.getByTestId('search-results-table')).not.toHaveClass( | ||
| 'effect-pulse', | ||
| ); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isLoadingto false makes the table say “No results found” while the new sample is still loading. If the prior range had rows, it says “End of Results” instead. Both messages make an unfinished refresh look complete.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentional. The footer sits inside the pulsing table, so "End of Results" / "No results found" pulse along with the previous patterns they belong to, the same way the empty state pulses on the number, bar and pie tiles (#3211). The pattern table doesn't pass a date range to the footer, so it doesn't claim anything about the new range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Since the footer is rendered inside the same scroll container receiving
effect-pulse, both “End of Results” and “No results found” remain visually associated with the previous patterns and are explicitly presented as part of the placeholder state—consistent with the empty-state behavior in the other dashboard tiles. The table does not expose the new date range in the footer, so it does not claim that the refreshed range is complete. I’m withdrawing this finding.